Strangeness in shell
Andy Heffernan
nichiren at glyph.UUCP
Wed Jul 26 14:52:38 AEST 1989
In article <2277 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>> Ummm... I had always learned (obviously flawed) that the single quotes
>>prevented expansion of ANYTHING....
>
[much deleted]
>
>>If you have no files ending in z , then why does it not return a null
>>string for the '*z' version ?
>
>Because that's the way the Bourne shell works. If a filename pattern
>doesn't match any file names, it is left unchanged, not expanded to a
>null string or a null list.
Yes, indeed.
For a simple-minded example of this feature in action,
we Bourne/Korn shell users can get away with:
$ uucp whereever!~uucp/goodstuff/* ~uucp/cache
to get everything in whereever's public goodstuff directory. Unless
your current directory contains a directory named "whereever!~uucp"
which contains a directory named "goodstuff", which in turn has some
non-dot files in it, the first argument to the command will expand to
itself, and so get passed to 'whereever' for expansion.
For C-shell users, at least the * in the above command needs quoting
against interpretation, and I guess the ! as well. (Beats me, I just ^P.)
--
-------------------------------------------------------------------------
Andy Heffernan uunet!glyph!nichiren [1222 - 1282]
-------------------------------------------------------------------------
"Dogpile on the rabbit! Dogpile on the rabbit!"
More information about the Comp.unix.questions
mailing list