I think that you're right to complain, but that you aren't quite
complaining about the right thing and are therefore offering the
wrong solution.  The problem is utilities which take list arguments,
but which treat empty lists differently.  Shell globbing rules can
make this better or worse, depending on context, but the problem
is in the semantics of our favourite utilities.  In a consistent
world

`cat' would concatenate 0 files, i.e. ouptut nothing,
`chmod 755' would set the permissions of no files to 755,
`cp foo/' would move no files to the directory foo,
`df' would show free disk space for no filesystems,
`kill' would stop no processes,
`ln foo/' would hardlink no files into the directory foo,
`ls' would list no files (you would use `ls .' for the usual case),
`mkdir' would create no directories,
`mv foo/' would move no files into the directory foo,
`ps -U' would show no users' processes,
`rm' would remove no files,
and `sh' would execute no scripts in the Bourne shell.

None of these would produce errors.  These are UNIX examples, but
Plan 9 is not much different in this regard.  A quick glance shows
that somewhere between a third and a half of all the basic utilities
have this property.  Nothing you do to the shell will change this
much.  A quick look through shell scripts I've written recently
convinces me that almost all of them would break if the basic
utilities were modified to treat empty lists consistently, even
though only one uses file name globbing in any way.

If you really want to fix the problem then the sensible thing
to do would be to write new versions of many utilities, with new
names, and then write a shell without globbing.  For new scripts
you would use the new utilities and shell and leave everything
else as it is.  Is it worth the effort?  That's a question which
can only be answered by the person who would be doing the work.
-- 
John Stalker
School of Mathematics
Trinity College Dublin
tel +353 1 896 1983
fax +353 1 896 2282

Reply via email to