Skip to content

Instantly share code, notes, and snippets.

@makeittotop
Last active February 29, 2020 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makeittotop/432416c495adcf870c9d2eee28e08e71 to your computer and use it in GitHub Desktop.
Save makeittotop/432416c495adcf870c9d2eee28e08e71 to your computer and use it in GitHub Desktop.
test
[apareek@foo github-test]$ cat ./find-ip-country.sh
#!/usr/bin/env bash
echo "Country: " $(curl -XGET http://whatismyipaddress.com/ip/"$1" -A "Mozilla/4.0" -s | grep -i country | sed 's/.*Country\:<\/th><td>//' | sed 's/<img.*//g') &
pid=$! # Process Id of the previous running command
spin='-\|/'
i=0
while kill -0 $pid 2>/dev/null
do
i=$(( (i+1) %4 ))
printf "\r${spin:$i:1}"
sleep .1
done
[apareek@foo github-test]$ ./find-ip-country.sh 191.96.249.53
/Country: Russia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment