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
I prefer not to use awk and such in scripts.. ip has the option to output in JSON.
awk
ip
If you leave out $interface then you get all of the ip addresses:
$interface
ip -json addr show $interface | \ jq -r '.[] | .addr_info[] | select(.family == "inet") | .local'