Removing file named -abc

Linux & Unix newsgroup archiveUnix Admin1998

Linuxmisc » Unix Admin

John Winga #1 / 24 Tue, 10 Mar 1998 03:00:00 GMT
: Can anyone tell me how to delete a file called -abc.  I've tried placing
: quotes around the filename and escaping the dash, but all the commands
: I've tried interprets the characters after the dash as options.

If your current directory is the one with the file:

   rm ./-abc

Sometimes the shortest name for a file is not the best one to use.

There are other solutions, but this one should work under any version of
Unix.

Hang around a while, and you will see this question come up again in a
month or so.

________________________________________________________________________
John Wingate                                           wing...@clark.net

Ron #2 / 24 Tue, 10 Mar 1998 03:00:00 GMT

rm ./-abc

--
Ron Whittle            rwhittl%pra.delta-air....@mindspring.com        
Technical Consultant | GCS/E d++(pu) s+: a C++++ US+++$> P+> L+> !E W+ N+++
Datronics inc.       | !o !K w--- M-- V-- PS+++ PE Y+ PGP t+++ 5 X+> tv+
                     | b++++ DI+++ D++(+++) G e++> h---- r+++ y++++

Alan H. Ka #3 / 24 Tue, 10 Mar 1998 03:00:00 GMT
In article <43ue41$...@explorer.csc.com>, thenr...@csc.com (Timothy

rm - -abc    or rm -- -abc

--
Alan H. Katz          | MJ Research, Inc.
al...@mjr.com         | 149 Grove St.
617-923-8001 ext.149  | Watertown, MA 02172
                      |

Throw Down Your Leavy Scree #4 / 24 Tue, 10 Mar 1998 03:00:00 GMT
In article <43ue41$...@explorer.csc.com>,

rm [directory]/-abc

For example, rm ~bubba/-abc

--
----------------------------------Matt Magnasco-------------------------------

                            Ready (?) for Round Two

Timothy Henri #5 / 24 Tue, 10 Mar 1998 03:00:00 GMT

Can anyone tell me how to delete a file called -abc.  I've tried placing
quotes around the filename and escaping the dash, but all the commands
I've tried interprets the characters after the dash as options.

Thanks,
-Tim

--
....................................................
thenr...@csc.com
Computer Sciences Corporation

Steve Thomps #6 / 24 Wed, 11 Mar 1998 03:00:00 GMT
In <43ue41$...@explorer.csc.com> thenr...@csc.com (Timothy Henrion) writes:

I had this happen to me, and after playing around in bash, I just decided to
do something like:

#include <stdio.h>
main()
{
unlink("-fubar");

I may have had to add in another #include, but this was an easy fix.

Regards,

--
--------------------------------------------------------- geek code v3.0: ---
Steve Thompson      GIT(AT) d-@ s++: a26(a@) c+++>++++++ UL++++$ P+>++++ L+++
BOFH, System Admin, E- W+ N+++ K w--- O? M- V? PS+++ PE-- Y++(@) PGP+(++) t-
ultratech.net       5-- X !R* tv--(@) b+++ DI++ D++@ G+ e- h+>++ r* y-(--)

J.Braina #7 / 24 Thu, 12 Mar 1998 03:00:00 GMT
<43ue41$...@explorer.csc.com> thenr...@csc.com (Timothy Henrion) writes:

yawn.
This must be in a FAQ _somewhere_  n'est-ce pas?

yourprompt% rm ?abc

will do it.

julii
--
---- Julii Brainard,  Environmental Sciences, University of East Anglia
Norwich NR4 7TJ, UK.  phone +44-1603-593127. email:  j.brain...@uea.ac.uk ---
  -------------------------------------------------------------------------
    Opinions Expressed are solely my own, not those of ENV or UEA.

Stephen P Pott #8 / 24 Fri, 13 Mar 1998 03:00:00 GMT
<43ue41$...@explorer.csc.com> thenr...@csc.com (Timothy Henrion) writes:
   >Can anyone tell me how to delete a file called -abc....

   yawn.
   This must be in a FAQ _somewhere_  n'est-ce pas?

Yes, it is a FAQ.  Too bad you got it wrong.

   yourprompt% rm ?abc

rm:  illegal option -a
rm:  illegal option -b
rm:  illegal option -c
Usage: rm [-fir] filename

   will do it.

Won't do it.  The question mark will be expanded by the shell before it is
passed to the command, which will still see "-abc" and think it is supposed
to be an option.

-spp
--
Stephen P Potter        Pencom Systems Administration         AMP Incorporated
s...@peach.epix.net s...@psa.pencom.com           steve.pot...@amp.com
Home: 717-540-0131      Pager: 1-800-759-8888, 547-9561     Work: 717-986-5401
                Systems Administation: It's a Kind of Magic

Jan Just [JJ] Keijs #9 / 24 Sat, 14 Mar 1998 03:00:00 GMT
In article <SPP.95Sep25190...@icarus.sunfire.com>,
   s...@icarus.sunfire.com (Stephen P Potter) wrote:
hmmm AIX has
  rm -- -abc
which works just fine... Don't know about other Unixes though

Jan Just (JJ) Keijser
Unix System Manager

--------------------------------------------------------------
- Jan Just (JJ) Keijser               My views are my own... -
- j...@lbvrtda.logica.com                                     -
--------------------------------------------------------------

Jamie Walt #10 / 24 Sun, 15 Mar 1998 03:00:00 GMT
: yawn.
: This must be in a FAQ _somewhere_  n'est-ce pas?
:
: yourprompt% rm ?abc

And what else? Not that this even works! Although I assume it must on
your machine - you did test it first ?

--------------------------------------------
| Jamie Walton | Usual story, kick it till |
| Christchurch | it works. By then you've  |
| New Zealand  | forgotten what you did!   |
--------------------------------------------

Jerry Crawfo #11 / 24 Sun, 15 Mar 1998 03:00:00 GMT
: : yawn.
: : This must be in a FAQ _somewhere_  n'est-ce pas?
: :
: : yourprompt% rm ?abc

: And what else? Not that this even works! Although I assume it must on
: your machine - you did test it first ?

: --------------------------------------------
: | Jamie Walton | Usual story, kick it till |
: | Christchurch | it works. By then you've  |
: | New Zealand  | forgotten what you did!   |
: --------------------------------------------

It is in the FAQ and <yawn> you need to do a  rm ./-abc
and all will be well again~

--
Unix Answers => This week special!  All stupid looks are ~~FREE~~

Nick Potka #12 / 24 Sun, 15 Mar 1998 03:00:00 GMT
On 27 Sep 1995, Jamie Walton wrote:

# rm -rf ./-abc

-Nick

  npot...@integ.micrognosis.com                           Nick Potkay

Stein I. Kr #13 / 24 Mon, 16 Mar 1998 03:00:00 GMT

Have a feeling I have said this before...

try:

rm -- -abc

OR

rm ./-abc

Sik
--
Stein I. Krav   !  Lately, there has been an alarming increase in the
s...@uow.edu.au  !   number of things I know absolutely nothing about.

snl.. #14 / 24 Mon, 16 Mar 1998 03:00:00 GMT
In <443pke$...@cpca7.uea.ac.uk>, ze...@cpca7.uea.ac.uk (J.Brainard) writes:

Maybe the questioner does't want to delete the files xabc and *abc
with it. Wake up mister! I like the earlier posted ./-abc solution
much better.

Gerold.

snl.. #15 / 24 Mon, 16 Mar 1998 03:00:00 GMT
In <443pke$...@cpca7.uea.ac.uk>, ze...@cpca7.uea.ac.uk (J.Brainard) writes:

No! it doesn't delete -abc at all! The shell expands ?abc to
-abc and then interprets it as an option!
rm ?abc removes all ?abc files except -abc.

Gerold.

Page 1 of 2: 1 2

This page is kept from the Linuxmisc archive of Linux and Unix newsgroups (snapshot 2023). Posts are shown as they were published, so commands, versions and addresses date from the original discussion. Linuxmisc.com now publishes a guide to online casinos in Canada.