Я пробовал это:
Код: Выделить всё
#!/bin/bash
echo "Unlocked WiFi Networks:"
echo "-----------------------"
# Get list of saved connections that are available and can be activated without user input
nmcli -f NAME,UUID,TYPE,DEVICE connection show --order +active | grep wifi | while read -r line
do
name=$(echo "$line" | awk '{print $1}')
device=$(echo "$line" | awk '{print $NF}')
if [ "$device" != "--" ]; then
echo "$name (Currently connected)"
else
# Check if the connection can be activated without user input
if nmcli connection up id "$name" --ask 2>/dev/null | grep -q "successfully activated"; then
echo "$name (Can connect without password)"
# Bring the connection back down to avoid interfering with current network
nmcli connection down id "$name" &>/dev/null
fi
fi
done
Подробнее здесь: https://stackoverflow.com/questions/790 ... e-terminal