bug-bash
[Top][All Lists]
Advanced

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

Re: Question about case statement in Bash docs


From: Andreas Schwab
Subject: Re: Question about case statement in Bash docs
Date: Mon, 10 May 2021 16:23:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

On Mai 10 2021, Greg Wooledge wrote:

> On Mon, May 10, 2021 at 09:12:33PM +1000, AlvinSeville7cf wrote:
>>    x=test
>>    case $x in
>>        "test") echo Y
>>    esac
>> 
>>    Pattern is quoted but no quote removal is performed according to docs.
>
> Quote removal is essential, because of the way the empty string
> is matched:
>
> case $foo in
>   "") echo "foo is empty";;
>   ...
>
> So, it may be a documentation omission, or maybe it's mentioned in some
> other paragraph, but either way quote removal definitely happens here.

IIUC there is no need for quote removal, because quoting is part of the
rules for pattern matching.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

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