Re: A Good Question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <kazrak+kernel@xxxxxxxxxxx>



- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux