I am trying to execute the following code with an IP address as a parameter from the commandline; however I am getting an error saying - ": line 6: syntax error near unexpected token `echo' "
.
#!/bin/sh
echo $1;
declare -a values=$(ssh -q jboss@$1 "ps -eo pcpu,pid,user | sort -r -k1 | less | grep jboss");
for value in ${values[*]} do
echo $value;
done
Please can you help me rectify this error?