I\'m trying to use just the IP address (inet) as a parameter in a script I wrote.
Is there an easy way in a unix terminal to get just the IP address, rather than loo
That would do the trick in a Mac :
ping $(ifconfig en0 | awk '$1 == "inet" {print $2}')
That resolved to ping 192.168.1.2 in my machine.
ping 192.168.1.2
Pro tip: $(...) means run whatever is inside the parentheses in a subshell and return that as the value.
$(...)