[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -eq and strings

From: Rob la Lau
Subject: Re: -eq and strings
Date: Mon, 6 Mar 2017 15:31:31 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.7.1

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 : address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]