GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — simple-bash-scripts/scripts/whereIP.sh at master · ruanyf/simple-bash-scripts

Expand file tree

/

whereIP.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
30 lines (22 loc) · 686 Bytes
/

whereIP.sh

Copy path

File metadata and controls

executable file
·
30 lines (22 loc) · 686 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
#
# Author: Abhishek Shingane ([email protected])
# Date: 11 Sep 2020
#
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed. Install via https://stedolan.github.io/jq/download/'
exit 1
fi
if [[ $# -ne 1 ]]; then
echo 'Provide I.P as command line parameter. Usage: ' $0 ' 15.45.0.1 '
exit 1
fi
link=$(echo "http://ip-api.com/json/"$1)
data=$(curl $link -s) # -s for slient output
status=$(echo $data | jq '.status' -r)
if [[ $status == "success" ]]; then
city=$(echo $data | jq '.city' -r)
regionName=$(echo $data | jq '.regionName' -r)
country=$( echo $data | jq '.country' -r)
echo $city, $regionName in $country.
fi
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.