This commit is contained in:
parent
c449dfcb5f
commit
559939e2f4
49 changed files with 729 additions and 252 deletions
|
|
@ -1,6 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
set -o pipefail
|
||||
#!/bin/bash
|
||||
|
||||
API_ENDPOINT="http://ip-api.com/json/$1"'?fields='
|
||||
FIELDS_FULL='7876383'
|
||||
|
|
@ -24,7 +22,7 @@ elif [ -t 1 ]; then
|
|||
notify-send -i /dev/null "IP Info" "$(get_stats)"
|
||||
else
|
||||
if [ -n "$1" ]; then
|
||||
resp="$(dig +short "$1" | tr -d $'\n')"
|
||||
resp="$(dig +short "$1" | tail -1 | tr -d $'\n')"
|
||||
[ -n "$resp" ] && printf "%s" "$resp" || { echo 'Not found!' >&2; exit 1; }
|
||||
else
|
||||
curl "${API_ENDPOINT}${FIELDS_SHORT}" 2>/dev/null | jq -r .query | tr -d $'\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue