Last active
February 29, 2020 01:40
-
-
Save makeittotop/432416c495adcf870c9d2eee28e08e71 to your computer and use it in GitHub Desktop.
test
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
[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