help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] confusion of shell's new option compat41


From: MaShimiao
Subject: Re: [Help-bash] confusion of shell's new option compat41
Date: Thu, 17 Jan 2013 12:35:16 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 01/17/2013 11:29 AM, Chet Ramey wrote:
On 1/16/13 9:21 PM, MaShimiao wrote:
On 01/17/2013 03:42 AM, Chet Ramey wrote:
On 1/16/13 1:06 PM, Ma Shimiao wrote:
According to changelog and manpage, I find compat as a new option is added.
I have read manpage for many times. But I actually can't find out what it
affects.
And I don't understand what special character means.

ManPage as follow:
compat41
              If set, bash, when in posix mode, treats a single quote in
a dou‐
              ble-quoted  parameter expansion as a special character.
The sin‐
              gle quotes must match (an even number) and the characters
between
              the single quotes are considered quoted.  This is the
behavior of
              posix mode  through  version  4.1.   The  default  bash
behavior
              remains as in previous versions.

Could someone give me a example shows how to use compat41?
Look at what a bash-4.2 instance running in Posix mode does with this:

echo "${HOME+'foo}"

with and without compat41 enabled.
I test in Fedora16 and bash-4.2.28. there is nothing difference.
That's actually a different problem -- the logic in bash-4.2 is broken for
setting the compat41 option.  It's fixed in the development version (which
is what I was testing on):
OK, I see. Thank you for helping me to solve the puzzle.

$ ./bash ./x25
4.3.0(21)-devel
'bar
./x25: line 10: unexpected EOF while looking for matching `''
./x25: line 11: syntax error: unexpected end of file
$ cat x25
echo $BASH_VERSION

set -o posix
foo=bar

shopt -u compat41
echo "${HOME+'$foo}"

shopt -s compat41
echo "${HOME+'$foo}"






reply via email to

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