Search Results

Search: Posts Made By: max_hammer
5,041
Posted By max_hammer
Thanks balajesuri for correction and information....
Thanks balajesuri for correction and information.

I am using ksh and single bracket works fine for ksh. :)
5,041
Posted By max_hammer
Which bash version you are using there was...
Which bash version you are using

there was a change between 3.1 and 3.2

if its 3.2 try


if [[ "${ch}" =~ [0-9] ]]


With out double quotes on regex.

Thanks Balasuri for...
5,041
Posted By max_hammer
You can use regular expression match if [...
You can use regular expression match

if [ "${ch}" =~ "[0-9]" ]
5,041
Posted By max_hammer
if [ "${ch}" -eq "3" -o "${ch}" -eq "4" ] ...
if [ "${ch}" -eq "3" -o "${ch}" -eq "4" ]


Should be


if [ "${ch}" = "3" -o "${ch}" = "4" ]

OR

if [ ${ch} -eq 3 -o ${ch} -eq 4 ]


= for comparing string
-eq for numbers
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 06:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy