[comp.unix.wizards] multiple names for files

chris@mimsy.UUCP (Chris Torek) (12/05/87)

In article <1413@bgsuvax.UUCP> denbeste@bgsuvax.UUCP (William C.
DenBesten) writes:
[re convincing rm to remove the file `-b']
>... I would be tempted to use ./-b myself, since it is independant
>of where you are.

When leading new users to Enlightenment :-), I avoid the name `./-b'
since it introduces the concept `working directory', and it is best
to confuse only one issue at a time (joke stolen from K&R).

Once they have the concept `pathname' down, *then* it is time to
introduce `working directory'.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

rjd@occrsh.ATT.COM.UUCP (12/06/87)

> DenBesten) writes:
> [re convincing rm to remove the file `-b']
> >... I would be tempted to use ./-b myself, since it is independant
> >of where you are.
> 
> When leading new users to Enlightenment :-), I avoid the name `./-b'
> since it introduces the concept `working directory', and it is best
> to confuse only one issue at a time (joke stolen from K&R).

   Maybe this was already mentioned (not all of this note string is here yet),
but one easy way to remove a filname beginning with a '-' is to take advantage
of the "getopt" processing of rm and make the "-" started file the second in a
list of files to remove.  For instance, if the "-b" file is the object of your
frustration, simply remove it by removing another file (doesn't matter if this
other file really exists or not) first on the same command line, e.g.:

$ rm g -b
rm: g non-existent	(You might want to verify that g does not exist first)
$ ls g -b
g: No such file or directory
-b: No such file or directory

     .... No problem.

Randy

chris@mimsy.UUCP (Chris Torek) (12/08/87)

In article <142700017@occrsh.ATT.COM> rjd@occrsh.ATT.COM writes:
[regarding me and someone else blathering on about `rm ./-b']
>... one easy way to remove a filname beginning with a '-' is to take
>advantage of the "getopt" processing of rm

(Who says it uses getopt?!  In fact, the 4BSD rm does not.)

>and make the "-" started file the second in a list of files to remove.

I already sent a response via mail, but decided that I just could
not let this go.  (Sorry...)  Yes, `rm nonexistentfile -b' works.
That is not the point.  Knowing this is like knowing that 0*x = 0
and 1*x = x: useful, but if you know *how to multiply*, you know
so much more.  `./-b' is a fully general way to name the file `-b'
without starting it with the dreaded hyphen.  ./-b ALWAYS WORKS,
just as a proper multiplication algorithm computes x from 1*x.

As long as they are not unweildy, general solutions should be
preferred over specific solutions.  That is what Unix is all about!

We now return you to your usual netnews. . . .
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris