Hi,
Thank you for helping me. The "test" example was just that.... An example. So that is not a problem, it was just to simplify.
The full thing:
1) extracting a number from a file and checking if it is different from what is supposed to be
set thenumber = `grep "something" $file | awk '{print $9}'`
if ($thenumber != 1500) then
echo ERROR
The above works ok
2) same as before, but in this case the thing to check is a word (or even more than one, but now I am testing with 1 word only). It does not seem working even with square brackets
set theword = `grep "somethingelse" $file | awk '{print $6}'`
if [$theword != NOT] then
echo ERROR
At stage two I have
if: Expression Syntax.
I tried to quote "NOT", no difference
---------- Post updated at 04:09 AM ---------- Previous update was at 04:05 AM ----------
Sorry, I've seen the problem (I think)
I had
=! for !=
---------- Post updated at 04:33 AM ---------- Previous update was at 04:09 AM ----------
It works but in the other way round
grep "somethingelse" $file | awk '{print $6}'
is NOT
so when I do
if [NOT != NOT] then
echo ERROR
I expect to do not see the error message, but I have it.
For some reason the word "NOT" extracted with grep is different from the second "NOT"?
I tried anyway to type manually also the first "NOT" (skipping the grep part, and I still have the error message: what is different between the 2 "NOT"?
if [NOT != NOT] then
echo ERROR