help-bash
[Top][All Lists]
Advanced

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

Re: Context sensitivity of the word "parameter" in the section of "Param


From: Peng Yu
Subject: Re: Context sensitivity of the word "parameter" in the section of "Parameter Expansion"
Date: Sun, 9 May 2021 13:51:05 -0500

My point is the manual is not clear. It is not how to make it work in this case.

On 5/9/21, Eli Schwartz <eschwartz@archlinux.org> wrote:
> On 5/9/21 11:59 AM, Peng Yu wrote:
>> Hi,
>>
>> In the following paragraph in the manual, "parameter" in
>> "${parameter}" could be "!".
>>
>> """
>>        ${parameter}
>>               The value of parameter is substituted.  ...
>> """
>>
>> However, "parameter" in "${#parameter}" can not be "!".
>>
>> """
>>        ${#parameter}
>>               Parameter length. ...
>> """
>>
>> $ echo "${!}"
>> 57766
>> $ echo "${#!}"
>> -bash: !}: event not found
>
> Works for me.
>
> $ echo $!
>
> $ echo ${#!}
> 0
>
>
> Try disabling history expansion, it tends to confuse things quite a bit
> before anything else. You need single quotes to suppress it, which means
> you cannot *also* do variable expansion, though you could fudge it with
> single-quoted assignment and `eval`.
>
>
>> So the word "parameter" in "${parameter}" and "${#parameter}" is not
>> the exactly same. Should this be made clearer in the manual?
>>
>> I have not checked "parameter" in all the cases in this section. But I
>> guess the word "parameter" in the whole section should be check for
>> ambiguity like this?
>>
>> This sentence is also not precise. ${!} obviously satisfies that the
>> first character is "!" and it is not a nameref. Yet ${!} is just the
>> process ID instead of a level of indirection.
>>
>> "       If the first character of parameter is an exclamation  point  (!),
>>  and
>>        parameter is not a nameref, it introduces a level of indirection."
>>
>
>
> --
> Eli Schwartz
> Bug Wrangler and Trusted User
>
>


-- 
Regards,
Peng



reply via email to

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