diff --git a/script/setup.sh b/script/setup.sh index 17db39f..916fe9a 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -5,20 +5,29 @@ invalidPID(){ [ $1 -lt 9 ] && return 1 return 0 } - -echo "Please select your device" -echo "1. ICS USB ADAPTER" -echo "2. SERIAL USB ADAPTER" -echo "3~5: nothing" -echo "6. ICS USB ADAPTER HS" -echo "7. SERIAL USB ADAPTER HS" -echo "8. DUAl USB ADAPTER HS" -read onePID -expr $onePID + 1 > /dev/null 2>&1 -INTCHECK=$? -if [ $INTCHECK -gt 1 ]; then - echo "Invalid argument" - return 1 +if [ $# -gt 0 ]; then + expr $1 + 1 > /dev/null 2>&1 + inputCheck=$? +else + inputCheck=5 +fi +if [ $inputCheck -gt 1 ]; then + echo "Please select your device" + echo "1. ICS USB ADAPTER" + echo "2. SERIAL USB ADAPTER" + echo "3~5: nothing" + echo "6. ICS USB ADAPTER HS" + echo "7. SERIAL USB ADAPTER HS" + echo "8. DUAl USB ADAPTER HS" + read onePID + expr $onePID + 1 > /dev/null 2>&1 + INTCHECK=$? + if [ $INTCHECK -gt 1 ]; then + echo "Invalid argument" + return 1 +fi +else + onePID=$1 fi if invalidPID $onePID; then echo "Out of range"