help-bash
[Top][All Lists]
Advanced

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

Re: umatched pattern in case-statement, why?


From: shynur .
Subject: Re: umatched pattern in case-statement, why?
Date: Tue, 3 Sep 2024 15:18:45 +0000

Thank you, Greg and Lawrence!  Thanks a lot.

Greg:
> The pattern is enclosed in double quotes, so all of the special
> characters in it lose their special meanings.
>
> Compare:
>
> hobbit:~$ case a in "?") echo yes;; esac
> hobbit:~$ case a in ?) echo yes;; esac
> yes
> hobbit:~$ 

Lawrence:
> To be clear, Greg is NOT saying that the "$" characters are being
> treated literally, suppressing parameter expansion.  The variables
> do get expanded, but the quoting causes all resulting characters
> to match literally.

I'm clear now.  This rule is documented in section 3.5.8.1 of the
Bash Reference Manual.


reply via email to

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