Created
May 20, 2016 16:55
-
-
Save travis-g/44f45cce68659406323d25a9356d891f to your computer and use it in GitHub Desktop.
Script for http://ifconfig.me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Script for http://ifconfig.me | |
usage () { | |
cat <<EOF | |
usage: $(basename $0) [-ahinpu] | |
-a return all available info | |
-h show help | |
-i return external IP address (default) | |
-n return remote host name | |
-p return port number | |
-u return user agent | |
EOF | |
} | |
test "$1" = "-h" && usage && exit 0 | |
case $1 in | |
-a) cmd=all ;; | |
-n) cmd=host ;; | |
-p) cmd=port ;; | |
-u) cmd=ua ;; | |
*) cmd=ip ;; | |
esac | |
curl ifconfig.me/$cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment