Removing file named -abc
Linuxmisc » Unix Admin
: 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
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++++
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
|
rm [directory]/-abc
For example, rm ~bubba/-abc
--
----------------------------------Matt Magnasco-------------------------------
Ready (?) for Round Two
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
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-(--)
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.
>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
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 -
--------------------------------------------------------------
: 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! |
--------------------------------------------
: : 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~~
# rm -rf ./-abc
-Nick
npot...@integ.micrognosis.com Nick Potkay
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.
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.
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