Advertisement
commandlinekid

Get your public IP address (shell script)

Jun 17th, 2022
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.11 KB | None | 0 0
  1. #!/bin/sh
  2. IP=$(curl https://api.ipify.org?format=json | grep -o '"ip":"[^"]*' | grep -o '[^"]*$')
  3. echo
  4. echo $IP
  5.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement