bug-coreutils
[Top][All Lists]
Advanced

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

Re: can't deal this kind of files, '-filename'


From: Marco Gerards
Subject: Re: can't deal this kind of files, '-filename'
Date: 18 Dec 2003 18:57:42 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Lee Huan Chul <address@hidden> writes:

[...]

> make file of which name is "-file" and do "ls *file"
> then error occures like this
> 
> ls: invalid option -- e
> Try `ls --help' for more information.
> 
> this is because coreutils uses raw argv(in main) as getopt's argument(in
> decode_switches, ls.c:1371).

This happens because all arguments that start with a '-' are parsed as
an option.  In this can -file means the same as -f -i -l -e.  The ls
command does not know the argument '-e'.

If you make the file -fil instead of -file you can see better what
happens.

To prevent ls from parsing the argument a options you can use "--" as
you can read in the documentation.  For example:

ls -- *file

--
Marco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]