I have been trying to add a wifi network with these commands inside a script:
adb shell wpa_cli -p /data/misc/wifi/sockets/ -i wlan0
# Get to wpa_cli prompt
adb shell wpa_cli -p /data/misc/wifi/sockets/ -i wlan0
# Add new WiFi network
adb shell add_network
adb shell set_network 0 auth_alg OPEN
adb shell set_network 0 key_mgmt WPA-PSK
adb shell set_network 0 ssid "Password"
adb shell set_network 0 proto RSN
adb shell set_network 0 mode 0
adb shell set_network 0 psk "Mynetwork name"
# Connect to it
adb shell select_network 0
adb shell enable_network 0
adb shell reassociate
# Check the status
adb shell status
but after the first command the terminal stays always in adb shell prompt and the other commands are not executed
ssid "Password"
andpsk "Mynetwork name"
intentional, or should these parameters be reversed?