[comp.unix.wizards] I have a file named "-"

thad@public.BTR.COM (Thaddeus P. Floryan) (02/26/91)

In article <22834@hydra.gatech.EDU> gt2807a@prism.gatech.EDU (Benjamin H. Cowan) writes:
>
>  I have a file whose name consists of the single character "-".  I can't
>rm it or mv it or cat it or more it or anything to it.  How can I get rid of
>it?

$ rm ./-

or you could "rm -fr *" followed by the Norton Utilities to undelete all
BUT the file named ``-''   :-)

Thad

P.S. I figured to answer this ASAP (and throw in some humor) before another
round of eleventy-seven flames begins re: inappropriate questions; sometimes
it's less tiresome to just answer than to get on a soapbox.

Thad Floryan [ thad@btr.com (OR) {dewcwrl, mips, fernwood}!btr!thad ]

tchrist@convex.COM (Tom Christiansen) (02/27/91)

From the keyboard of gt2807a@prism.gatech.EDU (Benjamin H. Cowan):
:  I have a file whose name consists of the single character "-".  I can't
:rm it or mv it or cat it or more it or anything to it.  How can I get rid of
:it?

Call the manufacturer.

Ask a coworker.

Burn your computer.

Throw out the disk.

Read The Fucking Manual.

Read the Damn Frequently Asked Questions List.


But don't post no-brainers to comp.unix.wizards -- that's 
not what this group is about.  


--tom
-- 
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist@convex.com      convex!tchrist

gt2807a@prism.gatech.EDU (Benjamin H. Cowan) (02/27/91)

In article <1991Feb26.170212.22920@convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>But don't post no-brainers to comp.unix.wizards -- that's 
>not what this group is about.  
>
>--tom

  With no-personality people like you around, the no-brain questions seem to
fit in perfect.  :-}

Ben...

subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (02/27/91)

In article <6661@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul Falstad) writes:
>tchrist@convex.COM (Tom Christiansen) wrote:
>>From the keyboard of gt2807a@prism.gatech.EDU (Benjamin H. Cowan):
>>:  I have a file whose name consists of the single character "-".  I can't
>>:rm it or mv it or cat it or more it or anything to it.  How can I get rid of
>>:it?
>
>>Ask a coworker.
>>
>>Burn your computer.
>>
>>Throw out the disk.
>
>Ask a coworker!?!  Please, please; let's at least answer the question
>before tempers get out of control.
>
>If you have a file that simply has a '/' in it, you can
>just quote the slash:
>
>   rm "/"
>
>But a file with a - in it takes special handling.  Fortunately there are
>many ways to remove a file like this.

[numerous software solutions deleted]

Aww, that's the problem with you CS majors: Now an EE like myself, I'd do
it this way;

    Go to the disk and assert the write signal for the particular track and
    sector, zero in on the right place, and poof -- your file is gone.

This is guaranteed to be the simplest and fastest way to do things, provably in order n log n time. (oops, that's a CS saying).

			-Kartik


e
x
t
r
a

l
i
n
e
s

f
o
r

i
n
e
w
s


--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao@phoenix.Princeton.EDU -| Internet
kartik@silvertone.Princeton.EDU (NeXT mail)  
SUBBARAO@PUCC.BITNET			          - Bitnet

emv@ox.com (Ed Vielmetti) (02/27/91)

In article <6668@idunno.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes:

   e	|  real wizards don't put in extra lines for inews.  they
   x    |  know that 1) it's evil to put in too much quoted text and
   t    |  2) inews is just a program which can be circumvented and
   r    |  3) it's ugly and pointless to waste lines.
   a    |  4) sets a bad example too.

   l    |  how do I remove a file "-" points out a flaw in the
   i    |  unix getopt scheme.  that "-" is often overloaded to
   n    |  mean "standard output" or "standard input" is another
   e    |  source of confusion.  exercise: describe other punctuation
   s    |  marks which the unix shells and c libraries abuse. 

   f    |  it's clear that there's a use for a newsgroup approximating
   o    |  the role of "ask mr. wizard".  what that group would be 
   r    |  named, got me.

   i    |  radical idea: a group which would be culled from the 
   n    |  best postings in the rest of comp.unix.*.
   e    |  ruthlessly moderated, indexed, and edited as necessary.  
   w    |  funded by either some government grant (not likely),
   s    |  subscriber fees, or something.

on the whole there's a lot of good stuff in comp.unix.*, but there's
also a lot of just plain old stuff.  

-- 
 Msen	Edward Vielmetti
/|---	moderator, comp.archives
	emv@msen.com

rodney@sun.ipl.rpi.edu (Rodney Peck II) (02/28/91)

>In article <6661@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul Falstad) writes:
>>Ask a coworker!?!  Please, please; let's at least answer the question
>>before tempers get out of control.
>>
>>If you have a file that simply has a '/' in it, you can
>>just quote the slash:
>>
>>   rm "/"
>>

"AAAAARRHRRHRHRGHGHGRAAH!"
"No, that's wrong," he said wondering when this would ever end.

I like the "ask a coworker" idea.  But if that isn't good enough, at least
don't give answers like this that are blatently incorrect.  Go ahead and 
make a file called / and try to do anything to it with quotes around the
/.  You can try '/', "/", './/', \/ and any other quoting you like, but
it simply will not work.

The answer to get around '-' as the first char is to get something else in
front of the -.  Generally, the answer is "rm ./-".

This group is fun -- it really tests your level of tolerance.
-- 
Rodney

pfalstad@phoenix.Princeton.EDU (Paul Falstad) (02/28/91)

rodney@sun.ipl.rpi.edu (Rodney Peck II) wrote:
>>In article <6661@idunno.Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul Falstad) writes:
>>>Ask a coworker!?!  Please, please; let's at least answer the question
>>>before tempers get out of control.
>>>
>>>If you have a file that simply has a '/' in it, you can
>>>just quote the slash:
>>>
>>>   rm "/"
>>>
>
>"AAAAARRHRRHRHRGHGHGRAAH!"
>"No, that's wrong," he said wondering when this would ever end.

sarcasm, n.:
   1. a mode of satirical wit depending for its effect on bitter,
      caustic, and often ironic language that is usu. directed against
      an individual.  syn see SATIRE.

Advice to all who replied: go back and read the post more carefully
before sending me email next time.

--
  David Hemmings appeared by permission of the National Forestry Commission.

rbj@uunet.UU.NET (Root Boy Jim) (02/28/91)

?  Paul Falstad, pfalstad@phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
?     Princeton University apologizes for the content of this article.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I hope so.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane