Re: nounset and $! behavior

2018-11-12 Thread Chet Ramey
On 11/12/18 6:55 PM, Grisha Levit wrote: > The following crashes bash: > > bash-5.0$ set -u > bash-5.0$ echo ${!,} > bash: $!: unbound variable > bash: !: unbound variable How does it `crash bash'? There's an extra error message, but it correctly notes that $! is not set. If the shell is not

Re: nounset and $! behavior

2018-11-12 Thread Grisha Levit
> How does it `crash bash'? Sorry, should have specified. I get the following backtrace (but only after doing the second expansion). $ env -i $BASH --norc -iuc $'echo ${!,} \n echo ${!,}'; echo $? bash: $!: unbound variable bash: !: unbound variable bash: $!: unbound variable 139 * thread #1,

nounset and $! behavior

2018-11-12 Thread Grisha Levit
The following crashes bash: bash-5.0$ set -u bash-5.0$ echo ${!,} bash: $!: unbound variable bash: !: unbound variable bash-5.0$ echo ${!,} bash: $!: unbound variable Testing if $! is set also doesn't seem to be possible: bash-5.0$ echo ${!-} bash: $!: unbound variable

null array[*] expansion not treated as null

2018-11-12 Thread Grisha Levit
When an array A has non-zero elements but the expansion of "${A[*]}" is still a null string, it is not treated as such for purposes of ${var:-X} expansion (though $* is treated as null in the same circumstance). $ A=(''); set -- '' $ echo "<${A[*]:-X}>" "<${*:-X}>" <> $ IFS=

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Didou Serge
Ok, maybe one day we can do it ... Thanks for your clarifications Regards, Serge. Le lun. 12 nov. 2018 à 19:09, Chet Ramey a écrit : > On 11/12/18 12:47 PM, Didou Serge wrote: > > But not work under linux... > > It's probably the difference between using pipes and FIFOs for process >

Re: [Help-bash] Using lastpipe causes function that takes stdin to fail

2018-11-12 Thread Chet Ramey
On 11/12/18 1:35 PM, Jesse Hathaway wrote: > On Mon, Nov 12, 2018 at 12:16 PM Chet Ramey wrote: >> Thanks for the report. This was a bug having to do with the nested >> pipelines and lastpipe, fixed back in August as the result of >> >> https://savannah.gnu.org/support/index.php?109541 > >

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Chet Ramey
On 11/12/18 12:47 PM, Didou Serge wrote: > But not work under linux... It's probably the difference between using pipes and FIFOs for process substitution and whether or not the OS makes the underlying file object seekable. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Chet Ramey
On 11/12/18 11:00 AM, Didou Serge wrote: > I tested with another configuration and ALL work fine: I don't use cygwin, so I can't verify what's happening. It's probably that everything is line-buffered, but I can't say for sure. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Chet Ramey
On 11/12/18 10:48 AM, Didou Serge wrote: > Ok, in this case, this should not work either: > > mapfile -C xx -c 1 UU  < <( echo -e "Premiere ligne" A{1..45} "\nDeuxieme > ligne" B{1..45} "\nTroisieme ligne" C{1..45}) > > But, this form work fine. Because the read function underlying mapfile

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Didou Serge
But not work under linux... Le lun. 12 nov. 2018 à 17:00, Didou Serge a écrit : > I tested with another configuration and ALL work fine: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: cygwin > Compiler: gcc > Compilation CFLAGS:

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Didou Serge
I tested with another configuration and ALL work fine: Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: cygwin Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='x86_64-unknown-cygwin'

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Didou Serge
Ok, in this case, this should not work either: mapfile -C xx -c 1 UU < <( echo -e "Premiere ligne" A{1..45} "\nDeuxieme ligne" B{1..45} "\nTroisieme ligne" C{1..45}) But, this form work fine. Le lun. 12 nov. 2018 à 15:44, Chet Ramey a écrit : > On 11/11/18 3:32 PM, Didou Serge wrote: > > >

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Chet Ramey
On 11/11/18 3:32 PM, Didou Serge wrote: > Bash Version: 4.4 > Patch Level: 7 > Release Status: release > > Description: > When use mapfile from normal file that call function that use mapfile, the > first mapfile lost data. > > Repeat-By: > I create 3 functions: > ww(){ echo "$@" | mapfile -C

Re: bash will not link against ncursesw and readline in /usr/local

2018-11-12 Thread Chet Ramey
On 11/11/18 6:34 AM, John Frankish wrote: > Using bash-4.4.18 > Intel core i7 laptop running 32-bit or 64-bit linux > Using gcc-8.2.0 > > The configure script does not find libncursesw on a system where only the > wide version of ncurses exists - even when readine is linked against > ncursesw.

Re: [mapfile]: problem reentrance with normal file

2018-11-12 Thread Greg Wooledge
On Sun, Nov 11, 2018 at 09:32:31PM +0100, Didou Serge wrote: > When use mapfile from normal file that call function that use mapfile, the > first mapfile lost data. > > Repeat-By: > I create 3 functions: > ww(){ echo "$@" | mapfile -C yy -c 1 -t TT ; } In this function, mapfile is being executed