Re: read with parameter expansion in here string

2013-11-22 Thread Chet Ramey
On 11/22/13, 9:22 AM, Clint Hepner wrote: > Bash Version: 4.2 > Patch Level: 45 > Release Status: release > > Description: > > An unquoted parameter expansion in a here string does not seem to > conform with my understanding of how > read works with a local IFS override. Persona

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Peggy Russell
> ... > $ IFS="" > $ f() { echo $1; }; x="a b c"; f $x > a b c > > But, IFS influences `read`, which of course benefits from word > splitting. In light of that conflict, I propose two possible > solutions: > > 1: shopt -s unsplit_vars > > which will turn off word splitting for var expansion. >

Re: read with parameter expansion in here string

2013-11-22 Thread Clint Hepner
On Nov 22, 2013, at 10:04 AM, Pierre Gaston wrote: > > > > On Fri, Nov 22, 2013 at 4:22 PM, Clint Hepner wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: darwin13.0.0 > Compiler: clang > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Aleksey Midenkov
On Fri, Nov 22, 2013 at 11:21 PM, Pierre Gaston wrote: > > > > On Fri, Nov 22, 2013 at 8:53 PM, Eric Blake wrote: >> >> On 11/22/2013 10:36 AM, Aleksey Midenkov wrote: >> >> > But nevertheless, I still find my proposal usable (since word >> > splitting for vars is unlikely to be usable in scripts

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 8:53 PM, Eric Blake wrote: > On 11/22/2013 10:36 AM, Aleksey Midenkov wrote: > > > But nevertheless, I still find my proposal usable (since word > > splitting for vars is unlikely to be usable in scripts). > > Scripts use word splitting on variables ALL the time. For exam

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Eduardo A . Bustamante López
> Yes, I know, I'd ever done alias for `read`: > > IFS="" > shopt -s expand_aliases > alias read='IFS=" " read' Why do you obfuscate your code with aliases? These just make debugging issues with your code harder. Remembering to quote variables and use a localized IFS for read is easier, than intro

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Eric Blake
On 11/22/2013 10:36 AM, Aleksey Midenkov wrote: > But nevertheless, I still find my proposal usable (since word > splitting for vars is unlikely to be usable in scripts). Scripts use word splitting on variables ALL the time. For example, I bet you have (multiple copies of) a script named install

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Aleksey Midenkov
On Fri, Nov 22, 2013 at 7:07 PM, Pierre Gaston wrote: > > > > On Fri, Nov 22, 2013 at 8:00 AM, Aleksey Midenkov wrote: >> >> Since word splitting in vars is used not more frequently than never, >> protecting all vars in scripts with double quotes is quite unpleasant >> thing. Therefore, I want ex

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Greg Wooledge
On Fri, Nov 22, 2013 at 10:00:28AM +0400, Aleksey Midenkov wrote: > 1: shopt -s unsplit_vars > > which will turn off word splitting for var expansion. Basically, you want zsh.

Re: RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 8:00 AM, Aleksey Midenkov wrote: > Since word splitting in vars is used not more frequently than never, > protecting all vars in scripts with double quotes is quite unpleasant > thing. Therefore, I want exactly this behavior always to be in my > scripts: > > $ IFS="" > $ f

Re: read with parameter expansion in here string

2013-11-22 Thread Pierre Gaston
On Fri, Nov 22, 2013 at 4:22 PM, Clint Hepner wrote: > Configuration Information [Automatically generated, do not change]: > Machine: i386 > OS: darwin13.0.0 > Compiler: clang > Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' > -DCONF_OSTYPE='darwin13.0.0' -DCONF_MACHTYPE='i386-apple

RFC: turn off word splitting for vars but keep for read

2013-11-22 Thread Aleksey Midenkov
Since word splitting in vars is used not more frequently than never, protecting all vars in scripts with double quotes is quite unpleasant thing. Therefore, I want exactly this behavior always to be in my scripts: $ IFS="" $ f() { echo $1; }; x="a b c"; f $x a b c But, IFS influences `read`, whic

read with parameter expansion in here string

2013-11-22 Thread Clint Hepner
Configuration Information [Automatically generated, do not change]: Machine: i386 OS: darwin13.0.0 Compiler: clang Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='darwin13.0.0' -DCONF_MACHTYPE='i386-apple-darwin13.0\ .0' -DCONF_VENDOR='apple' -DLOCALEDIR='/usr/local/Ce