Community Page
- www.tech-recipes.com/ Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- Please completely delte my MySpace Profile with all information. I do understand that this will be permanent...
- Thank you! This was very helpful.
- Opps I didn't see lift chair... "The 'gcc compiler' is installed when one installs 'XcodeTools' (via the 'XcodeTools.mpkg' file) from the installation CD (if...
- Sorry if i am repeating anyone but I know if you have mac 10.4.X then on the install disk you can find a copy of xcode...
- ok
Tech-Recipes
Cookbook of Tech TutorialsChecking if a variable is a number in ksh | Korn shell | Tech-Recipes
Started by qdideas · 9 months ago
9 months ago
You'll get FALSE!
From expr's man page:
EXIT STATUS
[...]
0 if the expression is neither NULL nor 0
1 if the expression is either NULL or 0
[...]
I'd use "-eq 2" instead of "-ne 0."
Thanks anyway, good tip.
5 months ago
2 months ago
G_VAR=$1
if [[ $G_VAR = +([0-9]) ]]; then
print "G_VAR is a number"
else
print "G_VAR is not a number"
fi