5

String comparisons

view full story
linux-howto

http://www.unix.com – Can someone please tell me what is wrong with this stings comparison? Code: #!/bin/sh #set -xv set -u VAR=$(ping -c 5 -w 10 google.com | grep icmp_req=5 | awk '{print $6}') echo I like cookies echo $VAR if "$VAR" == 'icmp_req=5' then echo You Rock else echo You Stink fi This is the error. I know its not a command. I don't understand why it thinks it is. I have tried single quotes, double quotes, single brackets, and double brackets with no luck. Code: $ bash ./ping I like cookies icmp_req=5 ./ping: line 7: icmp_req=5: command not found You Stink (HowTos)