Skip to content

Commit

Permalink
internet reverse reorder and keep unique (fixes #2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLKwong committed Mar 26, 2021
1 parent 147f9b7 commit 0380cf4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/internet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ function internet {
log_and_exit1 "Error: no internet found"
fi
info="$(curl -s ipinfo.io | grep -o '"[^"]*"\s*:\s*"[^"]*"')"
echo " INFO: $info"
echo "$info" | grep -E '"(ip)"'
echo "$info" | grep -E '"(org)"'
echo "1"
echo "$info" | grep -E '"(country)"'
echo "2"
echo "$info" | grep -E '"(city)"'
echo "3"
if ! echo "$info" | grep -E 'postal'; then
echo "$info" | grep -E '"(country|city)"' | tr '\n' ',' | sed 's/,$/, "postal": "n\/a"\n/' | sed 's/\",\"/\", \"/g'
else
Expand Down

0 comments on commit 0380cf4

Please sign in to comment.