Re: [DOC] Incomplete explanation about the regex =~ operator

2019-01-17 Thread Greg Wooledge
On Thu, Jan 17, 2019 at 07:53:09AM +0100, kevin wrote:
> I looked at Greg Wooledge's site 
> :
> 
> 
>Since *[[* isn't a normal command (like [ is), but a /shell
>keyword/, *it has special magical powers*. *It parses its arguments
>before they are expanded by Bash and does the expansion itself*,
>taking the result as a single argument, even if that result contains
>whitespace. (In other words, [[ does not allow word-splitting of its
>arguments.) /However/, be aware that simple strings still have to be
>quoted properly. [[ treats a space outside of quotes as an argument
>separator, just like Bash normally would.
> 
> Unfortunately, there is no example that shows how *[[* differs from the
> usual shell operation.

https://mywiki.wooledge.org/BashFAQ/031 may be a better reference.



Re: [DOC] Incomplete explanation about the regex =~ operator

2019-01-17 Thread Chet Ramey
On 1/17/19 1:53 AM, kevin wrote:

> 
>    Since *[[* isn't a normal command (like [ is), but a /shell
>    keyword/, *it has special magical powers*. *It parses its arguments
>    before they are expanded by Bash and does the expansion itself*,
>    taking the result as a single argument, even if that result contains
>    whitespace. (In other words, [[ does not allow word-splitting of its
>    arguments.) /However/, be aware that simple strings still have to be
>    quoted properly. [[ treats a space outside of quotes as an argument
>    separator, just like Bash normally would.
> 
> Unfortunately, there is no example that shows how *[[* differs from the
> usual shell operation. I know that the documentation does not indicate the
> particular property of "[[" (features)

Sure it does. The expansions and parsing are covered in the man page
description of `[['. For instance:

"Word  splitting  and pathname expansion are not performed on the
 words between the [[ and  ]];  tilde  expansion,  parameter  and
 variable  expansion, arithmetic expansion, command substitution,
 process substitution, and quote removal are  performed."

The parsing and expansions that `[[' performs are specified completely.
They are different from the set of word expansions a simple command
like `[' undergoes before it is executed.


, and there has been an adjustment
> based on the operator "==" concerning "=~" but I still do not understand
> why we could not have used the normal shell rules. In your example, a user
> may use single quotes to escape the special meaning of the $ sign "abc'$'".

What are those "normal shell rules?" And how would you have applied them
to specify something that was unspecified before? This discussion began in
mid-2006, maybe go back and look at the bug-bash archives to see what
people were reporting?

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: Typo in rluser.texi

2019-01-17 Thread Chet Ramey
On 1/16/19 6:55 PM, Jorge wrote:
> Line 2047 of lib/readline/doc/rluser.texi
> 
>> apply to completion on the inital non-assignment word on the line, or
> after a
> 
> It should say "initial".

Thanks for the report.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: grammatical error in manual

2019-01-17 Thread Chet Ramey
On 1/16/19 11:17 AM, Robert Swan wrote:
> Hello;
> 
> Section 3.5.3 Shell Parameter Expansion in the manual has a repeated phrase in
> the ${parameter%word} description, "If the pattern matches If the pattern
> matches".

Thanks for the report.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



bash-5.0: case command bug

2019-01-17 Thread Drab Martin

Hi,

I have a problem with bash 5.0:

-
machine1 ~ # bash --version
GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

machine1 ~ # case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is not a 
BUG" ;; esac
This is a BUG
-

as opposed to bash 4:

-
machine2 ~ # bash --version
GNU bash, version 4.4.23(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

machine2 ~ # case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is not a 
BUG" ;; esac
This is not a BUG
-

Is it a bug or a feature? Because for me it completely crippled Gentoo compilation system, as the config.sub does not 
work correctly anymore. Which in turn means that any automake building does not work as it results to:


-
machine1 ~ # /usr/share/gnuconfig/config.sub x86_64-pc-linux-gnu
Invalid configuration `x86_64-pc-linux-gnu': machine `x86_64-pc' not recognized
-

while it should do

-
machine2 # /usr/share/gnuconfig/config.sub x86_64-pc-linux-gnu
x86_64-pc-linux-gnu
-

Thank you.

Regards,
Martin



Re: bash-5.0: case command bug

2019-01-17 Thread Chet Ramey
On 1/17/19 6:21 PM, Drab Martin wrote:
> Hi,
> 
> I have a problem with bash 5.0:
> 
> -
> machine1 ~ # bash --version
> GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu)
> Copyright (C) 2019 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
> 
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> machine1 ~ # case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is
> not a BUG" ;; esac
> This is a BUG

I can't reproduce it:

$ cat x4
case "a-b" in *-*-*) echo "This is a BUG" ;; *) echo "This is not a BUG" ;;
esac
$ ../bash-5.0-patched/bash --version
GNU bash, version 5.0.2(3)-release (x86_64-apple-darwin18.2.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ../bash-5.0-patched/bash ./x4
This is not a BUG
$ ../bash-5.0/bash --version
GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ../bash-5.0/bash ./x4
This is not a BUG

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/