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 the shell, trying to make sense of quoting, word > splitting and the rest.
Those are two completely different things. If you want to know why word splitting is done the way it is, here is my *guess*. I think it's because (a) the original shell had no arrays, (b) the designers of Unix never used whitespace in filenames, so they never worried about it, and (c) they wanted to be able to do this: files='*.c *.h' for f in $files do .... If you want to know how to teach these things to newbies, that's a very different matter. The way we do it in #bash is to pound the phrase "USE MORE QUOTES!" into their heads over and over again until they submit.