|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Hello all
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. Cheer! Last edited by kc1979 : August 6th, 2003 at 11:16 AM. |
|
#2
|
|||
|
|||
|
"grep" expects a file as second parameter. (see "man grep")
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
read input
echo $input | grep ....... or wanted=`echo $input | grep -c.....` echo $wanted |
|
#4
|
||||
|
||||
|
grep problems
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: set -x ...and at the end of that section, set +x they enable and disable debugging feedback, another very useful thing to have in your toolbox. Cheers! -zedmelon
__________________
Mother says my .sig can beat up your .sig. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Shell script problem. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|