Hi all,
I'm writing a little shell script, but it I'm having a little problem.
The script has to write a other script, this is what I have:
Code:
echo "
INTIPP=$(which ifconfig) | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print \$1}'
echo ${INTIPP}
" > /script.sh
That's quite useless, I know, but is only a piece of the script
When I look into /script.sh, I see this:
Code:
INTIPP=/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
echo
Thats wrong, behind "echo", there should be my IP address.
When I execute the command
$(which ifconfig) | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' in a terminal, it works. But not from the script.
Any idea?
Thanks,
Kris