I have a bash script that launches a
ps command with a list of commands like this:
comando="ps -o pid,pcpu,cmd -C \"$2\""
$2 must be a variable in this form:
command1 command2 command3 ... commandn
How can i check this variable in order to avoid errors? I need a control (with an if) to check the pattern.
ps can be called in this way:
ps -o pid,pcpu,cmd -C "command1 command2 ... commandn". If someone calls this bash script as
script.sh -C " command1 command2", the ps command returns "IMPROPER LIST". I want to avoid the
ps error and echo my error before launching