aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <pcmsinan@gmail.com>2023-03-08 15:16:15 +0530
committersinanmohd <pcmsinan@gmail.com>2023-03-11 19:05:05 +0530
commit1489b3dd44cd2e2534a4fa148f8541d9565fd090 (patch)
treedb59ed41e443014dbb32104971026ee00a7e7c45
parentb46c3bca9dd291b04d8af9f62d845a29616b8e33 (diff)
wip: print details to stdout, only send notification if notify-send is installed
-rwxr-xr-xwip5
1 files changed, 4 insertions, 1 deletions
diff --git a/wip b/wip
index dcc3ca3..62e2718 100755
--- a/wip
+++ b/wip
@@ -3,4 +3,7 @@
current_ip=$(dig +short myip.opendns.com @208.67.222.222)
geo_loc_ip=$(geoiplookup "$current_ip" | grep -v "Country" | sed 's/^.*: //g')
-notify-send " $current_ip" "$geo_loc_ip"
+
+command -v "notify-send" 1>/dev/null &&
+ notify-send " $current_ip" "$geo_loc_ip"
+printf "ipv4: %s\n%s\n" "$current_ip" "$geo_loc_ip"