![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| check the given string is numeric or not. | knowledge_gain | High Level Programming | 11 | 02-03-2009 11:25 AM |
| to check variable if its non numeric | sachin.gangadha | Shell Programming and Scripting | 3 | 12-06-2007 05:33 PM |
| Perl code to differentiate numeric and non-numeric input | Raynon | Shell Programming and Scripting | 11 | 08-04-2007 10:32 AM |
| How to check for a valid numeric input | Vijayakumarpc | Shell Programming and Scripting | 1 | 08-04-2007 08:34 AM |
| How to check a column contain numeric or char data type ?? | jambesh | Shell Programming and Scripting | 12 | 10-06-2006 10:37 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Quote:
#!/bin/ksh echo "Digits as input" read number test=`echo "$number" | egrep "^[0-9]+$"` if [ "$test" ] then echo "Entered number is a digit" else echo "0" fi Instead of egrep you can use awk,grep or any command for searching patterns. Thanks Namish |
|
||||
|
Hi all,
I think i have some idea of converting your ksh to csh. See below! Thanks all for the help!!! Code:
#!/bin/csh echo -n "Pls input: " set number = ($<) test=`echo "$number" | egrep "^[0-9]+$"` if [ "$test" ] then echo "Entered number is a digit" else echo "0" endif |
|
||||
|
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| grep or |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|