I'm trying to run a command that grabs my current IP address (or addresses) and saves this to a variable so that I can then see on screen. I want to do this so that I can run this in a script and use the variable in a loop.
userip='ifconfig | grep "inet addr:" | cut -d: -f2 | awk '{print $1}''
echo $userip
Everytime I run this command, its basically getting the speech marks mixed up and thus not running whole command.
It's really just got 'ifconfig | grep "inet addr:" | cut -d: -f2 | awk '
in the single quotations.
Any advice would be extremely helpful thanks.