Don't read from pipe if we have more than 2 arguments

This commit is contained in:
oblique 2013-11-17 01:46:56 +02:00
parent f143ddd584
commit d3be5fa7a0

View File

@ -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