Re: inconsistent field splitting

2010-08-18 Thread Greg Wooledge
On Wed, Aug 18, 2010 at 12:53:25PM +0100, Marc Herbert wrote: > > Sorry but I am not interested at all in how the current implementation > works. I am only wondering why it was *designed* like this. > > Try to remove your expert hat for one second and take the stance of > some developer new to th

Re: inconsistent field splitting

2010-08-18 Thread Andreas Schwab
Marc Herbert writes: > Sorry but I am not interested at all in how the current implementation > works. I am only wondering why it was *designed* like this. A variable can only contain a single string of characters. There is nothing at all to split. > "Everything makes sense" is a nice feature

Re: inconsistent field splitting

2010-08-18 Thread Marc Herbert
Le 18/08/2010 12:14, Andreas Schwab a écrit : > Marc Herbert writes: >> In any case it should not perform any *implicit* (and >> thus confusing) quoting. > > There is no quoting, the shell just doesn't split into words, I know but it looks like quoting, because quoting is how you prevent word sp

Re: inconsistent field splitting

2010-08-18 Thread Andreas Schwab
Marc Herbert writes: > Probably result in some error; I do not really care in this initial > stage. In any case it should not perform any *implicit* (and > thus confusing) quoting. There is no quoting, the shell just doesn't split into words, which doesn't make any sense in an assignment. > Quo

Re: inconsistent field splitting

2010-08-18 Thread Marc Herbert
> What should a=* or a=$(echo 1 2) do? > Assign only the first file or just 1 to a? or result in an error? Probably result in some error; I do not really care in this initial stage. In any case it should not perform any *implicit* (and thus confusing) quoting. > This hardly seem more consistent

Re: inconsistent field splitting

2010-08-18 Thread Pierre Gaston
On Wed, Aug 18, 2010 at 12:36 PM, Marc Herbert wrote: > Compare: > >   for a in "$(echo 1 2)"; do echo "x${a}x"; done > x1 2x >   for a in  $(echo 1 2) ; do echo "x${a}x"; done > x1x > x2x > >   a="$(echo 1 2)"; echo "x${a}x" > x1 2x >    a=$(echo 1 2);  echo "x${a}x" > x1 2x > > > > Shell quoting

Re: inconsistent field splitting

2010-08-18 Thread Andreas Schwab
Marc Herbert writes: >for a in $(echo 1 2) ; do echo "x${a}x"; done This applies word splitting on the expansion of $(echo 1 2). > a=$(echo 1 2); echo "x${a}x" This doesn't. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5

inconsistent field splitting

2010-08-18 Thread Marc Herbert
Compare: for a in "$(echo 1 2)"; do echo "x${a}x"; done x1 2x for a in $(echo 1 2) ; do echo "x${a}x"; done x1x x2x a="$(echo 1 2)"; echo "x${a}x" x1 2x a=$(echo 1 2); echo "x${a}x" x1 2x Shell quoting is difficult enough; why is such an inconsistency making it even more confusi