Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

Top Document: Unix - Frequently Asked Questions (2/7) [Frequent posting]
Previous Document: News Headers
Next Document: How do I remove a file with funny characters in the filename ?


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

How do I remove a file whose name begins with a "-" ?



2.1)  How do I remove a file whose name begins with a "-" ?

      Figure out some way to name the file so that it doesn't begin
      with a dash.  The simplest answer is to use

            rm ./-filename

      (assuming "-filename" is in the current directory, of course.)
      This method of avoiding the interpretation of the "-" works with
      other commands too.

      Many commands, particularly those that have been written to use
      the "getopt(3)" argument parsing routine, accept a "--" argument
      which means "this is the last option, anything after this is not
      an option", so your version of rm might handle "rm -- -filename".
      Some versions of rm that don't use getopt() treat a single "-"
      in the same way, so you can also try "rm - -filename".



Top Document: Unix - Frequently Asked Questions (2/7) [Frequent posting]
Previous Document: News Headers
Next Document: How do I remove a file with funny characters in the filename ?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
tmatimar@isgtec.com (Ted Timar)

Last Update May 13 2007 @ 00:24 AM