Re: -eq and strings

2017-03-06 Thread Rob la Lau
this method fails if the shell is ksh" Thanks! -- -- Rob la Lau -- -- Sysadmin en webdeveloper in ruste -- -- web : https://ohreally.nl/ -- eml : r...@ohreally.nl --

Re: -eq and strings

2017-03-06 Thread Rob la Lau
ow 1 regex won't considerably slow down my script, but it's become a habit to always try and program as light as possible. -- -- Rob la Lau -- -- Sysadmin en webdeveloper in ruste -- -- web : https://ohreally.nl/ -- eml : r...@ohreally.nl --

Re: -eq and strings

2017-03-06 Thread Rob la Lau
x" ] && echo "yes" || echo "no" [: invalid integer 'x' no I hope this won't be fixed, as I rely quite heavily on this behaviour, lacking some other short 'is integer' test. Cheers, Rob -- -- Rob la Lau -- -- Sysadmin en webdeveloper in ruste -- -- web : https://ohreally.nl/ -- eml : r...@ohreally.nl --

-eq and strings

2017-03-04 Thread Rob la Lau
st whether a variable is an integer. $ [ "${x}" -eq "${x}" ] 2> /dev/null && echo "yes" || echo "no" ... Looking a bit further: it doesn't do any comparison on the given strings: $ [[ "x" -eq "y" ]] && echo "yes" || echo "no" yes $ [[ "x" -eq "yz" ]] && echo "yes" || echo "no" yes but it does on integers: $ [[ 1 -eq 2 ]] && echo "yes" || echo "no" no Kind regards, Rob -- -- Rob la Lau -- -- Sysadmin en webdeveloper in ruste -- -- web : https://ohreally.nl/ -- eml : r...@ohreally.nl --