On 06-03-17 15:16, Reuti wrote:
> if ! expr "$x" : '[[:digit:]]*$' >/dev/null; then echo no; fi
> 
> if [ -n "${x//[0-9]/}" ]; then echo no; fi

True, but regular expressions are usually considered expensive.
(Must admit I never benchmarked.)

And I know 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
--

Reply via email to