You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
265 B

#!/bin/sh
curl_ret=$(curl -s https://ipinfo.io)
awk_state="/\"$1\"/ {print \$2\" \"\$3\" \"\$4\" \"\$5\" \"\$6}"
#echo "CR: $curl_ret"
#echo "AS: $awk_state"
if [ "$1" == "" ]; then
echo "$curl_ret"
else
echo "$curl_ret" | awk "$awk_state" | cut -d'"' -f2
fi