bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Pierre Gaston
Subject: Re: RFC: turn off word splitting for vars but keep for read
Date: Fri, 22 Nov 2013 21:21:14 +0200

On Fri, Nov 22, 2013 at 8:53 PM, Eric Blake <address@hidden> 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 example, I
> bet you have (multiple copies of) a script named install-sh somewhere on
> your system.  It frequently uses word split variables, such as these
> setup lines:
>
> rmprog=${RMPROG-rm}
> ...
> rmcmd="$rmprog -f"
>
> for use in constructs like this:
>           $doit $rmcmd -f "$dst" 2>/dev/null ||
>
> Disabling word splitting for an interactive shell is one thing (and in
> fact, zsh has done that in their default mode), but for scripting, you
> would break LOTS of existing scripts if you changed the default behavior
> of word splitting.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
> well, he proposes an option to turn on these behavior, not to change the
default behaviour.
I reckon something like shopt -s autoquote_expansions could be useful


reply via email to

[Prev in Thread] Current Thread [Next in Thread]