bug-bash
[Top][All Lists]
Advanced

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

Re: Bug: please document extended and alternate for loop syntax


From: Lawrence Velázquez
Subject: Re: Bug: please document extended and alternate for loop syntax
Date: Mon, 10 Mar 2025 16:13:16 -0400

On Mon, Mar 10, 2025, at 12:38 PM, Zachary Santer wrote:
> There are other weird, undocumented things that you could have the
> same conversation about. ${#@} is equivalent to ${#}

This is documented and not at all weird.  $# came from Bourne, and
${#@} is a logical extension of ${#var} that happens to expand to
the same value.

        #
                ($#) Expands to the number of positional parameters
                in decimal.

https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html

        ${#parameter}
                The length in characters of the expanded value of
                _parameter_ is substituted.  If _parameter_ is `*'
                or `@', the value substituted is the number of
                positional parameters.

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

-- 
vq



reply via email to

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