Harry Putnam
2011-Nov-23 19:43 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
Somehow I touched some rather peculiar file names in ~. Experimenting with something I''ve now forgotten I guess. Anyway I now have 3 zero length files with names -O, -c, -k. I''ve tried as many styles of escaping as I could come up with but all are rejected like this: rm \-c rm: illegal option -- c usage: rm [-fiRr] file ... Ditto for: [\-]c ''-c'' *c ''-''c \075c OK, I''m out of escapes. or other tricks... other than using emacs but I haven''t installed emacs as yet. I can just ignore them of course, until such time as I do get emacs installed, but by now I just want to know how it might be done from a shell prompt.
Will Murnane
2011-Nov-23 19:46 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
On Wed, Nov 23, 2011 at 14:43, Harry Putnam <reader at newsguy.com> wrote:> Somehow I touched some rather peculiar file names in ~. ?Experimenting > with something I''ve now forgotten I guess. > > Anyway I now have 3 zero length files with names -O, -c, -k. > > I''ve tried as many styles of escaping as I could come up with but all > are rejected like this: > > ?rm \-c > ?rm: illegal option -- c > ?usage: rm [-fiRr] file ... > > Ditto for: > > ?[\-]c > ?''-c'' > ?*c > ?''-''c > ?\075c > > OK, I''m out of escapes. ?or other tricks... other than using emacs but > I haven''t installed emacs as yet. > > I can just ignore them of course, until such time as I do get emacs > installed, but by now I just want to know how it might be done from a > shell prompt.rm ./-O ./-c ./-k or pass an entire path.
Bryan Horstmann-Allen
2011-Nov-23 20:27 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
+------------------------------------------------------------------------------ | On 2011-11-23 13:43:10, Harry Putnam wrote: | | Somehow I touched some rather peculiar file names in ~. Experimenting | with something I''ve now forgotten I guess. | | Anyway I now have 3 zero length files with names -O, -c, -k. Use ''--'' to denote the end of arguments. $ uname -a SunOS lab 5.10 Generic_142910-17 i86pc i386 i86pc $ touch -- -c $ ls -l total 1 -rw-r--r-- 1 bda bda 0 Nov 23 15:25 -c $ rm -- -c $ ls -l total 0 Cheers. -- bdha cyberpunk is dead. long live cyberpunk.
Jason King (Gmail)
2011-Nov-23 22:00 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
Did you try rm -- filename ? Sent from my iPhone On Nov 23, 2011, at 1:43 PM, Harry Putnam <reader at newsguy.com> wrote:> Somehow I touched some rather peculiar file names in ~. Experimenting > with something I''ve now forgotten I guess. > > Anyway I now have 3 zero length files with names -O, -c, -k. > > I''ve tried as many styles of escaping as I could come up with but all > are rejected like this: > > rm \-c > rm: illegal option -- c > usage: rm [-fiRr] file ... > > Ditto for: > > [\-]c > ''-c'' > *c > ''-''c > \075c > > OK, I''m out of escapes. or other tricks... other than using emacs but > I haven''t installed emacs as yet. > > I can just ignore them of course, until such time as I do get emacs > installed, but by now I just want to know how it might be done from a > shell prompt. > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Brandon High
2011-Nov-26 11:30 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
On Wed, Nov 23, 2011 at 11:43 AM, Harry Putnam <reader at newsguy.com> wrote:> OK, I''m out of escapes. ?or other tricks... other than using emacs but > I haven''t installed emacs as yet. > > I can just ignore them of course, until such time as I do get emacs > installed, but by now I just want to know how it might be done from a > shell prompt.rm ./-c ./-O ./-k -- Brandon High : bhigh at freaks.com
Harry Putnam
2011-Nov-26 13:30 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
[...] Harry wrote:>> ?rm \-c >> ?rm: illegal option -- c >> ?usage: rm [-fiRr] file ... >> >> Ditto for: >> >> ?[\-]c >> ?''-c'' >> ?*c >> ?''-''c >> ?\075c >> >> OK, I''m out of escapes. ?or other tricks... other than using emacs but >> I haven''t installed emacs as yet. >> >> I can just ignore them of course, until such time as I do get emacs >> installed, but by now I just want to know how it might be done from a >> shell prompt.Will Murnane <will.murnane at gmail.com> writes:> rm ./-O ./-c ./-k > or pass an entire path.Bryan Horstmann-Allen <bda at mirrorshades.net> writes: [...]> > Use ''--'' to denote the end of arguments. >[...] Brandon High <bhigh at freaks.com> writes: [...]> rm ./-c ./-O ./-kThanks folks. Both techniques work without fail. Its always something easy and usually the needed info is already flopping around somewhere in my brain, but not put together.
Gregg Wonderly
2011-Nov-28 15:18 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
On 11/26/2011 5:30 AM, Brandon High wrote:> On Wed, Nov 23, 2011 at 11:43 AM, Harry Putnam<reader at newsguy.com> wrote: >> OK, I''m out of escapes. or other tricks... other than using emacs but >> I haven''t installed emacs as yet. >> >> I can just ignore them of course, until such time as I do get emacs >> installed, but by now I just want to know how it might be done from a >> shell prompt. > rm ./-c ./-O ./-kAnd many versions of getopt support the use of -- as the "end of options" indicator so that you can do rm -- -c -O -k to remove those as well. Gregg Wonderly
Smith, David W.
2011-Nov-28 17:28 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
You could list by inode, then use find with rm. # ls -i 7223 -O # find . -inum 7223 -exec rm {} \; David On 11/23/11 2:00 PM, "Jason King (Gmail)" <jason.brian.king at gmail.com> wrote:> Did you try rm -- filename ? > > Sent from my iPhone > > On Nov 23, 2011, at 1:43 PM, Harry Putnam <reader at newsguy.com> wrote: > >> Somehow I touched some rather peculiar file names in ~. Experimenting >> with something I''ve now forgotten I guess. >> >> Anyway I now have 3 zero length files with names -O, -c, -k. >> >> I''ve tried as many styles of escaping as I could come up with but all >> are rejected like this: >> >> rm \-c >> rm: illegal option -- c >> usage: rm [-fiRr] file ... >> >> Ditto for: >> >> [\-]c >> ''-c'' >> *c >> ''-''c >> \075c >> >> OK, I''m out of escapes. or other tricks... other than using emacs but >> I haven''t installed emacs as yet. >> >> I can just ignore them of course, until such time as I do get emacs >> installed, but by now I just want to know how it might be done from a >> shell prompt. >> >> _______________________________________________ >> zfs-discuss mailing list >> zfs-discuss at opensolaris.org >> http://mail.opensolaris.org/mailman/listinfo/zfs-discuss > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Nico Williams
2011-Nov-28 17:35 UTC
[zfs-discuss] grrr, How to get rid of mis-touched file named `-c''
On Mon, Nov 28, 2011 at 11:28 AM, Smith, David W. <smith107 at llnl.gov> wrote:> You could list by inode, then use find with rm. > > # ls -i > 7223 -O > > # find . -inum 7223 -exec rm {} \;This is the one solution I''d recommend against, since it would remove hardlinks that you might care about. Also, this thread is getting long, repetitive, tiring. Please stop. This is a standard issue Unix beginner question, just like "my test program does nothing". Nico --