I need to make a script that gets my public IP address from a website and prints it out.
#!/bin/bash wget http://www.ipchicken.com/ grep
I don't know where to go from here.
Please help
I need to make a script that gets my public IP address from a website and prints it out.
#!/bin/bash wget http://www.ipchicken.com/ grep
I don't know where to go from here.
Please help
What you're trying to do is fragile; it depends on the format of the HTML document returned by ipchicken, and that can change without warning. This currently works for me, your mileage may vary:
$ wget http://www.ipchicken.com/ -qO - | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" 108.27.105.76
You can use http://plain-text-ip.com/
:
wget -qO- http://plain-text-ip.com/; echo 18?.1?.2?.5?