Bash - Get Vagrant IP Address

# outside of vagrant local_vagrant_ip=$(vagrant ssh -c "ip address | grep 'inet ' | sed -e 's/^.*inet //' -e 's/\/.*$//'"); echo $local_vagrant_ip; # inside vagrant ip address | grep 'inet ' | sed -e 's/^.*inet //' -e 's/\/.*$//' # limit to local ip ip address show eth1 | grep 'inet ' | sed -e 's/^.*inet //' -e 's/\/.*$//' # show all IP Address information ip address

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.