help-bash
[Top][All Lists]
Advanced

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

Re: Check if file size greater than a small number?


From: Lawrence Velázquez
Subject: Re: Check if file size greater than a small number?
Date: Thu, 10 Mar 2022 15:52:04 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4778-g14fba9972e-fm-20220217.001-g14fba997

On Thu, Mar 10, 2022, at 11:30 AM, Jesse Hathaway wrote:
> +    "[...] Variables",
> +    "are created with local scope inside a function unless the -g option",
> +    "is specified. [...]"

I don't think this is desirable.  It would make the stat builtin
work differently from every other command that sets a variable.

    bash-5.1$ f1() { read var <<<abc; }
    bash-5.1$ f2() { printf -v var %s ghi; }
    bash-5.1$ f3() { readarray var <<<$'d\ne\nf'; }
    bash-5.1$ declare -p var
    bash: declare: var: not found
    bash-5.1$ (f1; declare -p var)
    declare -- var="abc"
    bash-5.1$ (f2; declare -p var)
    declare -- var="ghi"
    bash-5.1$ (f3; declare -p var)
    declare -a var=([0]=$'d\n' [1]=$'e\n' [2]=$'f\n')

-- 
vq



reply via email to

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