[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash-5.2-alpha available
From: |
Robert Elz |
Subject: |
Re: Bash-5.2-alpha available |
Date: |
Tue, 25 Jan 2022 01:51:18 +0700 |
Date: Mon, 24 Jan 2022 12:03:39 -0500
From: Chet Ramey <chet.ramey@case.edu>
Message-ID: <3aeb9d02-b134-216f-6d11-921e42941522@case.edu>
| Except it's not unconditional. You have to accommodate ${x#$'value'} in
| the here-document expansion path because "${x#$'value'}" is processed for
| escape sequences. You're right that it should not be treated differently,
| but it's not as simple as leaving $'...' and $"..." unmodified.
Quite correct, here docs (with unquoted delim word on the redirect operator)
are read exactly the same as double-quoted strings (except " is just a
character, nothing special at all, including \" resulting in 2 chars, not one).
>From a non-bash sh ...
$ x=abcdef
$ cat <<EOF
${x#$'abc'}
EOF
def
$
No escape chars used there, but if they had been, they would have worked,
as the word after the # (or % and ## %% of course) is parsed in its own
quoting context, regardless of what the context is of the overall expansion.
And, of course:
$ cat <<EOF
$'abc'
EOF
$'abc'
$
I should have changed PS1 away from being '$ ' I guess, let me do those
two again with PS1='<%> ' just to avoid any ambiguity...
$ PS1='<%> '
<%> cat <<EOF
${x#$'abc'}
EOF
def
<%> cat <<EOF
$'abc'
EOF
$'abc'
<%>
(I didn't bother to repeat the initialisation of x - nothing changed it).
kre
- Re: Bash-5.2-alpha available, (continued)
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/22
- Re: Bash-5.2-alpha available, Oğuz, 2022/01/22
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/22
- Re: Bash-5.2-alpha available, Oğuz, 2022/01/22
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/22
- Re: Bash-5.2-alpha available, Sam James, 2022/01/22
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/22
- Re: Bash-5.2-alpha available, Andreas Schwab, 2022/01/22
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/22
- Re: Bash-5.2-alpha available, Chet Ramey, 2022/01/24
- Re: Bash-5.2-alpha available,
Robert Elz <=
Re: Bash-5.2-alpha available, Andreas Schwab, 2022/01/22
Re: Bash-5.2-alpha available, Ángel, 2022/01/23