I'm trying this command
for x in qstat -u '*' | grep Eqw | awk {'print $1'}; do qmod -cj $x; done
and end up with this error:
-bash: syntax error near unexpected token `|'
I've tried wrapping my qstat command in various quotes and brackets to no avail, what am I doing wrong?
由于您似乎想遍历结果,因此将其更改为:
for x in `qstat -u '*' | grep Eqw | awk {'print $1'}`; do qmod -cj $x; done
An optimised version will be :
for x in $(qstat -u '*' | awk '/Eqw/{print $1}'); do qmod -cj "$x"; done
awk
can grep hitself Use this sript instead:
for x in $(qstat -u * | awk '/Eqw/ {print $1}')
do
qmod -cj $x
done
它应该是:
for x in $(qstat -u '*' | grep Eqw | awk '{print $1}'); do qmod -cj $x; done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.