raspberry pi zero based drum machine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

set_wifi.sh 607B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. FILE=wifi.txt
  3. declare -i _iter=0
  4. declare -i _first=0
  5. if [ -f "$FILE" ]; then
  6. echo "" >> /etc/wpa_supplicant/wpa_supplicant.conf
  7. echo "network={" >> /etc/wpa_supplicant/wpa_supplicant.conf
  8. echo "$FILE exists."
  9. while read line; do
  10. if (($_iter==0));
  11. then
  12. echo "this"
  13. echo " ssid=\"$line\"" >> /etc/wpa_supplicant/wpa_supplicant.conf
  14. else
  15. echo "that"
  16. echo " psk=\"$line\"" >> /etc/wpa_supplicant/wpa_supplicant.conf
  17. fi
  18. #$_iter += 1
  19. let "_iter+=1"
  20. done < wifi.txt
  21. echo "}" >> /etc/wpa_supplicant/wpa_supplicant.conf
  22. rm wifi.txt
  23. fi