help-bash
[Top][All Lists]
Advanced

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

Re: Checking numeric arguments


From: Alex fxmbsw7 Ratchev
Subject: Re: Checking numeric arguments
Date: Wed, 17 Nov 2021 16:40:55 +0100

cause [[ is bash code that recognizes a few things
its splitting on spaces, normally, and i just wanna tell u the quoting is
somewhat of not needed

there are like 3 cases of usage of data
one is var=assignment, like new=$spaces, that preserves var content to its
defining fmt
another is bash code that wanted to recognize without spaces
and one is app or function "arg with spaces"
here u only need the quotes
another sub case is where globbing happens $var not quoted can contain
globbing code, where with quotes its passes as data

greets

On Wed, Nov 17, 2021, 16:24 irenezerafa <irenezerafa@protonmail.com> wrote:

>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Wednesday, November 17th, 2021 at 8:46 AM, Alex fxmbsw7 Ratchev <
> fxmbsw7@gmail.com> wrote:
>
> and no need to quote that left side inside [[
>
>
> Is that because there will never be any splitting for numeric values?
>
>
> On Wed, Nov 17, 2021, 09:46 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
> wrote:
>
>> you can combine && etc inside [[ too
>>
>> On Wed, Nov 17, 2021, 09:45 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
>> wrote:
>>
>>> it.. would work, imho
>>>
>>> On Wed, Nov 17, 2021, 04:04 irenezerafa via <help-bash@gnu.org> wrote:
>>>
>>>> I want to check if arguments are numeric. Is the following a good way,
>>>> using case-like patterns
>>>> and using = inside double bracketing [[ ]].
>>>>
>>>> if [[ "$2" = +([[:digit:]]) ]] && [[ "$3" = +([[:digit:]]) ]]; then
>>>>
>>>


reply via email to

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