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

2013-11-25 Thread Bob Proulx
Greg Wooledge wrote: > Bob Proulx wrote: > > Aleksey Midenkov wrote: > > > rmcmd="$rmprog -f" > > > > > > Because it will fail for files with spaces. > > > > I am sure we disagree but I don't consider making rm program names > > have spaces to be reasonable. :-/ > > > > What would it be? "remo

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

2013-11-25 Thread Greg Wooledge
On Sun, Nov 24, 2013 at 08:41:46PM -0700, Bob Proulx wrote: > Aleksey Midenkov wrote: > > rmcmd="$rmprog -f" > > > > Because it will fail for files with spaces. > > I am sure we disagree but I don't consider making rm program names > have spaces to be reasonable. :-/ > > What would it be? "rem

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

2013-11-24 Thread Bob Proulx
Aleksey Midenkov wrote: > I would say, that this style generally is wrong: > > rmprog=${RMPROG-rm} > rmcmd="$rmprog -f" > > Because it will fail for files with spaces. I am sure we disagree but I don't consider making rm program names have spaces to be reasonable. :-/ What would it be? "remov

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: 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

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