0

Please help, I can only see forums with this question for Bash, KSH, and others

Need to apply it on csh.

to check if the inputted $2 is not number nor the word "all"

if ($#argv == 2 && ($2 != all && $2 != **any number**)) then
   echo "wrong parameter"

Thanks in advance!

user68890
  • 69
  • 1
  • 4
  • 10
  • You posted a similar question, which I answered: http://stackoverflow.com/questions/26457720/regex-to-check-if-input-is-number-in-cshunix – supergra Oct 23 '14 at 18:54

1 Answers1

0

this one just search for any letter of _ characted in $2:

if ( ($#argv == 2 && $2 != all && `echo $2 | grep -c '[_A-Za-z]') then
     echo "wrong parameter"
endif
Baruch
  • 1
  • 1