Advertisement
u0xpsec

is_conneted.sh

Dec 1st, 2018
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/bin/zsh
  2. #
  3. # Author: u0xpsec 2018
  4. #
  5. if [[ `nmcli -t device show wlp3s0 | grep "GENERAL.STATE"` == *"(connected)"* ]] || [[ `nmcli -t device show enp0s25 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  6. if [[ `nmcli -t device show wlp3s0 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  7. echo "< wifi connected:" `nmcli -t device show wlp3s0 | grep "GENERAL.CONNECTION" | cut -d":" -f2-` ">"
  8. elif [[ `nmcli -t device show enp0s25 | grep "GENERAL.STATE"` == *"(connected)"* ]];then
  9. echo "───────- < Cable connected:" `nmcli -t device show enp0s25 | grep "GENERAL.CONNECTION" | cut -d":" -f2-` ">"
  10. fi
  11. else
  12. echo "< not connected >"
  13. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement