Skip to content

Instantly share code, notes, and snippets.

@hieudang-agilityio
Last active October 22, 2019 07:06
Show Gist options
  • Save hieudang-agilityio/854a54ea8099bae83d24d85c0e6aee39 to your computer and use it in GitHub Desktop.
Save hieudang-agilityio/854a54ea8099bae83d24d85c0e6aee39 to your computer and use it in GitHub Desktop.
#!/bin/bash
IP=$1
# Run curl file.sh | sh to find the public ip address
if [ "$IP" = "" ]; then
echo "Your IP is: "
curl https://ipinfo.io/ip
else
# Run curl file.sh | sh -s "0.0.0.0" to find the info of ip address you inputted
echo "Info of the ip you inputted: "
curl https://ipinfo.io/$IP
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment