On Wed, Mar 15, 2006 at 12:35:01AM -0600, Mike Miller wrote:
> On Tue, 14 Mar 2006, Florin Iucha wrote:
> >>rm blackmail letter
> >>
> >>humans can't reliably determine whether the intent is to delete one
> >>file named "blackmail letter" or two separate files named "blackmail"
> >>and "letter", so how do you expect something as simple-minded as bash
> >>to do so?
> >
> >Sure humans can, and bash can too. The meaning is unambiguous.
> 
> I'm not sure I understand everything here (e.g., the reference to a 
> difference between how 'touch' and 'rm' handle spaces), but I think the 
> way to think about it is in terms of what our rules are for handling 
> spaces in command lines.  The rule is that the space character is a 
> separator.  So a command like this...
> 
> rm blackmail letter
> 
> ...will attempt to delete two files in every shell I know of.  To delete a 
> single file named "blackmail letter", we have to either escape the space 
> or use quotes:
> 
> rm blackmail\ letter
> rm "blackmail letter"
> rm 'blackmail letter'
> 
> All three of those commands do the same thing in both bash and tcsh, and 
> probably in quite a few other shells.  I would not call this 
> "disambiguating" the command because there is nothing ambiguous about 
> this...
> 
> rm blackmail letter
> 
> ...because it means "delete two files - one filename is 'blackmail' and 
> the other filename is 'letter'".

Exactly, that's what I say it is unambiguous. We agree. The ambiguity
is not in the shell syntax, but in our desire to have our cake and eat
it too: use space as a separator _between shell arguments_ (because
they look like words in a sentence) and between _words in file names_
(possibly for the same reason).

> >>memory.  Reliable determination of "this space is part of a filename,
> >>that space separates filenames" is not readily solvable (and I tend
> >>to suspect that it's not solvable at all).
> >
> >Ok, so the machine cannot guess which of the two conveniences I mean to 
> >request at a given moment. It is not an algorithmic problem - (think of 
> >touch instead of rm), so I expect a smart interactive shell to prompt me 
> >to disambiguate, yet to specifiy one mandatory separator in interpreted 
> >mode and be done with it.

My mention to rm vs. touch was that in the rm case, presumably the
file(s) exist and if the shell can partially disambiguate based on that
information (if "blackmail" and "letter" exist, the user wanted them
destroyed, if "blacmail letter" exists, the user wanted it destroyed,
otherwise ask). But that is even less likely with mkdir or touch,
since none of those files supposedly exists before, to aid in
disambiguation.

It is all a matter of convenience.

florin

-- 
Don't question authority: they don't know either!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20060315/616ed69e/attachment.pgp