MLUG: Re: [MLUG] deleting a file named '-'
Re: [MLUG] deleting a file named '-'
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
In bash this isn't any big deal. I do it all the time just by backslashing
the spaces.

*^*^*^*
Have the courage to take your own thoughts seriously, for they will shape
you. -- Albert Einstein

On Thu, 1 Mar 2001, Mike Miller wrote:

> While I was testing a shell script and learning a few tricks, I
> accidentally created a file called '-'.  That was it's name -- just a
> hyphen.  That file was a nightmare to delete, at least on Solaris with
> tcsh.  I tried all the command-line tricks -- quotes, back slashes,
> renaming, rm -i *, rm -i ?, etc., etc., etc.  Finally, I called up a
> graphical file manager and deleted it that way.
> 
> Darn, I was going to ask how to delete a file with that name but I just
> figured it out:
> 
> rm ./-
> 
> That did it.  Why didn't I think of that before?  Oh well.  It seems
> simple now, but believe me, I tried *many* reasonable things that all
> totally failed.
> 
> Ever have a file named '*' (without the quotes) that you wanted to delete?  
> Be careful!  How about a file named '!' (without the quotes)?  I've dealt
> with such mysteries easily, but the darned '-' had me perplexed for at
> least 5 minutes.  :-)
> 
> Mike
> 
> --
> To manage your subscription, go to http://mlug.missouri.edu/members/edit.php
> 
> Archives are available at http://mlug.missouri.edu/list-archives/
> 

--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/