The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Checking numeric value
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Checking numeric value
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
05-25-2007
Abhishek Ghose
Registered User
Join Date: Sep 2005
Location: Chennai
Posts: 81
Oneliner
Here's an oneliner:
awk -v x=$a 'END{if(x==x+0) print "integer"}' /dev/null
In this example , a is shell variable.
If a=10, then the output of above is "integer"
If a="10abhishek", then the output of above is ""
Abhishek Ghose
View Public Profile
Find all posts by Abhishek Ghose
Find Abhishek Ghose's past nominations received
Find Abhishek Ghose's present nominations given