August 4th, 2003, 03:43 AM
ksh shell problem.
If I want to check whether the input is numeric (without contain any characters). which syntax will be used ( grep, fgrep or other..).
Because I am a unix novice. Could any one give me some example.
Last edited by kc1979; August 6th, 2003 at 11:16 AM.
August 4th, 2003, 11:48 AM
"grep" expects a file as second parameter. (see "man grep")
August 4th, 2003, 01:28 PM
echo $input | grep .......
wanted=`echo $input | grep -c.....`
August 6th, 2003, 01:39 AM
I like the korn shell too.
I'd figure out what results you expect from
grep -c '^[a-zA-Z]$' "$mins"
...and then assign that to a variable, and THEN compare it in your if statement. One thing that helps me greatly when I'm having a problem is simplifying down to one step at a time (heh... not just shell scripting either).
Also, put a line at the beginning of a troubled section like this:
...and at the end of that section,
they enable and disable debugging feedback, another very useful thing to have in your toolbox.
Mother says my .sig can beat up your .sig.