commit d3be5fa7a0ece612a844507be44e96a519524b8a
parent f143ddd5841b76c72360ec62ee61164969331761
Author: oblique <psyberbits@gmail.com>
Date: Sun, 17 Nov 2013 01:46:56 +0200
Don't read from pipe if we have more than 2 arguments
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/create_ap b/create_ap
@@ -94,9 +94,10 @@ if [[ $# -lt 1 ]]; then
usage
exit 1
fi
+
WIFI_IFACE=$1
-if tty -s; then
+if [[ $# -gt 2 ]]; then
if [[ $SHARE_INTERNET -eq 1 ]]; then
if [[ $# -ne 3 && $# -ne 4 ]]; then
usage
@@ -121,8 +122,14 @@ else
fi
INTERNET_IFACE=$2
fi
- read SSID
- read PASSPHRASE
+ if tty -s; then
+ read -p "SSID: " SSID
+ read -p "Passphrase: " -s PASSPHRASE
+ echo
+ else
+ read SSID
+ read PASSPHRASE
+ fi
fi
if [[ $(id -u) -ne 0 ]]; then