grep acting strange in script
I'm writing a for my wireless card to be able to switch easy between networks and connect to them. The script it self is working fine but after the connection i want to output a "status raport" of the network connection.
One of the things i wanted to report was the ip but as soon as i us a grep command it acts strange and doesn't give any output. I've tryed the commands themself in the shell and they all work but as soon as i try them form the script it fails
IP=`/sbin/ifconfig wlan0 | grep inet | cut -d: -f2 | cut -d' ' -f1`
this works in the shell but not in the script
Does anybody now why and how i can fix this.