Aug 22, 2006 #1 h3nd Programmer Jul 1, 2006 147 AU Hi guys, I have to tried to validate whether the value is digit. I have tried this one but it's not working. Code: [[ "$f" == "[[:digit:]]" ]] anyone can help me ?? Thx
Hi guys, I have to tried to validate whether the value is digit. I have tried this one but it's not working. Code: [[ "$f" == "[[:digit:]]" ]] anyone can help me ?? Thx
Aug 22, 2006 #2 kHz MIS Dec 6, 2004 1,359 US Code: [[ $f == [0-9] ]] Ever think of buying the O'Reilly "Learning the Korn Shell" book? It would answer most of the questions you ask. Upvote 0 Downvote
Code: [[ $f == [0-9] ]] Ever think of buying the O'Reilly "Learning the Korn Shell" book? It would answer most of the questions you ask.
Aug 28, 2006 #3 PHV MIS Nov 8, 2002 53,708 FR A portable way: case $f in *[!0-9]*) echo $f BAD;; *) echo $f OK;; esac Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
A portable way: case $f in *[!0-9]*) echo $f BAD;; *) echo $f OK;; esac Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Aug 29, 2006 Thread starter #4 h3nd Programmer Jul 1, 2006 147 AU Thx guys, kHz, the problem is my number could be many digits. PHV, thx. but I think it's better using : [[ $f == [0-9][0-9][0-9][0-9][0-9][0-9] ]] Upvote 0 Downvote
Thx guys, kHz, the problem is my number could be many digits. PHV, thx. but I think it's better using : [[ $f == [0-9][0-9][0-9][0-9][0-9][0-9] ]]
Aug 29, 2006 #5 PHV MIS Nov 8, 2002 53,708 FR It's better if you want a number with exactly 6 digits. Upvote 0 Downvote