LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2011, 12:01 PM   #1
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Rep: Reputation: 1
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 ?

Last edited by mmhs; 02-18-2011 at 12:03 PM.
 
Old 02-18-2011, 12:15 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.

Last edited by Nylex; 02-18-2011 at 12:20 PM.
 
Old 02-18-2011, 12:54 PM   #3
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Nylex View Post
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
 
0 members found this post helpful.
Old 02-18-2011, 01:27 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Then you need to tell us what exactly it is you want to do..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
message sending failed : Error[22 ] invalid argument .....but each and every argument rakeshranjanjha Linux - Software 2 01-08-2008 12:22 AM
Help Me!! [ too many argument ] firetankiee1 Programming 5 04-16-2006 11:46 AM
I need help in an argument! cleorobrepixbox General 11 09-23-2004 09:29 PM
Possible Idea for Argument??? TheTrueVortek General 17 11-25-2003 06:35 PM
rsync - need some argument help bkeating Linux - Software 0 10-21-2003 07:25 PM


All times are GMT -5. The time now is 02:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration