I wrote the line below in order to verify if the first or second fields of a list of numbers are equal to 146.
I want to run the line from tcsh, with one line interpreted by bash.
What's the problem here?
echo $numbers
146 146 0 16 16 10 42 12 10 32 32 3 2 32 26
tcsh
bash -c 'for i in 1 2; do if [ 146 = `echo $numbers | cut -f$i -d' ' ` ]; then echo "NUM is OK "; fi done'
The errors:
` ]; then echo "NUM is OK "; fi done: -c: line 0: unexpected EOF while looking for matching ``'
` ]; then echo "NUM is OK "; fi done: -c: line 1: syntax error: unexpected end of file

"146" ==instead of146 =– saeedn Oct 21 '12 at 13:23bash -c "for i in 1 2; do if [ 146 = `echo $numbers | cut -f$i -d' ' ` ]; then echo 'NUM is OK '; fi done"– saeedn Oct 21 '12 at 13:32