Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash for loop syntax error with pipe

Tags:

bash

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?

like image 833
erimar77 Avatar asked Dec 20 '22 14:12

erimar77


1 Answers

Since you seem to want to loop through on the result, so change it to:

for x in `qstat -u '*' | grep Eqw | awk {'print $1'}`; do qmod -cj $x; done
like image 196
P.P Avatar answered Jan 12 '23 19:01

P.P