From 175cc6d0238e28b575bbe7f5a386c576307d8d0e Mon Sep 17 00:00:00 2001 From: aman vsihwakarma Date: Sun, 17 Mar 2024 12:03:30 +0530 Subject: [PATCH] added code for wifi detection --- scripts/wifi-ssid | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/wifi-ssid b/scripts/wifi-ssid index 29af3cc..1df823f 100755 --- a/scripts/wifi-ssid +++ b/scripts/wifi-ssid @@ -2,3 +2,11 @@ # Extract the wifi username (SSID) # Refer: "iw dev wlan0 link" command output for this + +ssid=$(iwconfig wlan0 | awk -F '"' '/ESSID/ {print $2}') + +if [ -n "$ssid" ]; then + echo "WiFi SSID: $ssid" +else + echo "WiFi SSID not available" +fi