You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
611 B
Plaintext
19 lines
611 B
Plaintext
2 years ago
|
#!/bin/bash
|
||
|
|
||
|
# Retrieve saved network names from wpa_supplicant
|
||
|
networks=$(wpa_cli -i wlan0 list_networks | awk '{print $2}')
|
||
|
|
||
|
# Display network names using dmenu and store the selected network
|
||
|
selected_network=$(echo "$networks" | dmenu -p "Select a network:")
|
||
|
|
||
|
# Get network ID from network name
|
||
|
network_id=$(wpa_cli -i wlan0 list_networks | grep $selected_network | awk '{print $1}')
|
||
|
|
||
|
# Check if a network was selected
|
||
|
if [ -n "$network_id" ]; then
|
||
|
# Connect to the selected network using wpa_supplicant
|
||
|
wpa_cli -i wlan0 select_network "$network_id"
|
||
|
echo "Connecting to $selected_network..."
|
||
|
fi
|
||
|
|