From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Woods Subject: Re: A Good Question. Date: Tue, 30 Mar 2004 23:28:28 -0700 Sender: linux-admin-owner@vger.kernel.org Message-ID: <6.0.1.1.0.20040330231516.03ffbbf8@no.incoming.mail> References: <001e01c416e4$cef31c10$020aa8c0@Scott> Mime-Version: 1.0 Return-path: In-Reply-To: <001e01c416e4$cef31c10$020aa8c0@Scott> References: <001e01c416e4$cef31c10$020aa8c0@Scott> List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit To: "Scott@Charter" Cc: Linux-Admin-Group At 3/30/2004 09:55 PM -0800, Scott@Charter wrote: >1. How would you create a file named "--help"? >I actually created a the file by doing something like touch test >>--help. >But I think there is a "proper" way to create it? Commands that interpret --help as an option should (but might not) support -- to indicate "end of options" and all arguments following are to be interpreted as "non-option". Which means if the command takes a list of files as arguments you can force it to recognize arguments beginning with - as files by preceeding them with --. For example, the following hypothetical command line: $ somecommand --someoption --another -- --justafile --notanoption --help should treat --someoption and --another as options, but --justafile --notanoption and --help should be treated as files (or whatever somecommand wants to use those arguments for). If touch tries to interpret --help as an option, then "touch -- --help" should treat --help as a filename. >2. How would you remove a file named "--help"? Likewise, "rm -- --help" should remove filename --help You could also use a partial or absolute path to the file, e.g.: $ touch ./--help or $ touch $PWD/--help If in doubt, sticking "./" in front of a filename in the current directory can simplify ornery cases like this. Bonus problems: How to create and delete file names with spaces or control characters? How about slashes (not as a directory delimiter) in the filename? -- Jeff Woods