LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   too many argument (https://www.linuxquestions.org/questions/linux-newbie-8/too-many-argument-863558/)

mmhs 02-18-2011 11:01 AM

too many argument
 
hey guys i have a problem with while statement

i want to write shell script that give a number between 1-3444 from user and if user enter out of range number give error

e.g number must between

read -p "plz Enter Number " p

while [ $p != [1-9] -o $p != [1-9][0-9] -o $p != [1-3][0-4][0-4][0-4] ]
do
read -p "plz Enter Valid Number" p
done


but this have an error in while statement ! two many argument

who can help me ?

Nylex 02-18-2011 11:15 AM

Why can't you just test whether the value is greater than or equal to 1 and less than or equal to 3444? You might want to look at the Advanced Bash-Scripting Guide (specifically section 7.3).

Also, this would probably be better off in Programming, so I'm reporting it to be moved there.

mmhs 02-18-2011 11:54 AM

Quote:

Originally Posted by Nylex (Post 4262878)
Why can't you just test whether the value is greater than or equal to 1 and less than or equal to 3444? You might want to look at the Advanced Bash-Scripting Guide (specifically section 7.3).

Also, this would probably be better off in Programming, so I'm reporting it to be moved there.

thx man but it is just a sample not really my goal

and what about char !!! by this work i filter just numbers

Nylex 02-18-2011 12:27 PM

Then you need to tell us what exactly it is you want to do..


All times are GMT -5. The time now is 11:30 AM.