#!/bin/bash # network-wifi-connect.sh # This program connects to a user defined Wi-Fi interface. # Copyright (c) 2024, Scott C. MacCallum (scott@scm-guru.live). # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # Change this variable to the group that should be informed of a need to # charge the battery. On GNU/Linux distributions users are often part of # a group that is the same as their login name, which works well if you only # want your user to be informed on the console. interface="wlp2s0" echo -n "SSID: " read ssid echo -n "Password: " read password wpa_passphrase $ssid $password >> /etc/wpa_supplicant/wpa_supplicant.conf wpa_supplicant -i $interface -c /etc/wpa_supplicant/wpa_supplicant.conf exit 0