[英]syntax error near unexpected token `echo'
I am trying to execute the following code with an IP address as a parameter from the commandline; 我试图用命令行中的IP地址作为参数执行以下代码; however I am getting an error saying - ": line 6: syntax error near unexpected token `echo' "
但我得到一个错误说 - “:第6行:意外令牌`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? 你能帮我纠正这个错误吗?
Put a ;
放一个
;
in front of the do, or put the do on a new line. 在做的前面,或者做一个新线。
for value in ${values[*]}; do
echo $value
done
The ;
的
;
behind "echo $value" isn't needed except if you write the done
directly behind it. 不需要“echo $ value”,除非你直接
done
后面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.