I tried to run the following commands in my shell script.
This command works fine for me:
ssh -n "${username}"@"${hostname}" "grep WARNING ${serverhome}/${serverlog} | wc -l"
The result is:
1548
However when i try to run a similar one:
ssh -n "${username}"@"${hostname}" "test `grep -q WARNING ${serverhome}/${serverlog}` && echo warning || echo good"
I get:
grep: /home/test-user/server/server.*.log: No such file or directory
I suspect i did not use the proper quote characters in the second command. But i don't know how to fix it. Thanks for the help.