Re: Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space

2018-07-20 Thread Bob Proulx
Denys Vlasenko wrote: > $ f() { for i; do echo "|$i|"; done; } > $ x=x > $ e= > $ f ${x:+ ""} > ^^^ prints nothing, bug? > > $ ${x:+"" } > ^^^ prints nothing, bug? Insufficient quoting. That argument should be quoted to avoid the whitespace getting stripped. (Is that during wor

Re: [1] 69728 segmentation fault bash

2018-07-20 Thread Clint Hepner
> On 2018 Jul 20 , at 10:40 a, Mr Guiguilebreton wrote: > > Yes, i now. I test the syntax and the parse error because I programming a > command interpreter bash in C language and I report the Segmentation Fault > for help you to debug. If you want I can help you free to solve the problem. Se

Re: Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space

2018-07-20 Thread Denys Vlasenko
On 07/20/2018 04:43 PM, Denys Vlasenko wrote: $  ${x:+"" } ^^^ prints nothing, bug? Should be: $ f ${x:+"" } $ f ${x:+"$e""$e"""} ^^^ prints nothing, bug? Should be: $ f ${x:+"$e""$e" ""} sorry.

Empty ""s in ARG in ${x:+ARG} expand to no words instead of the empty word if prepended/appended with space

2018-07-20 Thread Denys Vlasenko
$ f() { for i; do echo "|$i|"; done; } $ x=x $ e= $ f ${x:+""} || ^^^ correct $ f ${x:+ ""} ^^^ prints nothing, bug? $ ${x:+"" } ^^^ prints nothing, bug? $ f ${x:+"$e"} || ^^^ correct $ f ${x:+ "$e"} ^^^ prints nothing, bug? $ f ${x:+"$e""$e"""} || ^

Re: [1] 69728 segmentation fault bash

2018-07-20 Thread Clint Hepner
> On 2018 Jul 20 , at 9:27 a, Mr Guiguilebreton wrote: > > Hello, check this command in GNU bash, version 3.2.57(1)-release > (x86_64-apple-darwin17): > > ls () { ls -lG;}; ls You wrote a recursive function with no base case. Don't do that. ls () { command ls -lG; }; ls or use an alias

[1] 69728 segmentation fault bash

2018-07-20 Thread Mr Guiguilebreton
Hello, check this command in GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17): ls () { ls -lG;}; ls freely, Guillaume Madec (+33)6 46 01 00 79 PS: It's a pleasure to help the FSF