Thanks for the report. But what you are reporting is expected
behavior. This is not a bug in chown or other utility.
Adam Hayes wrote:
> I (accidentally) created a file in the working directory named
> "--exclude". When I ran
> chown [username] *
> in that directory, it gave an error:
> chown: unrecognized option `--exclude'
Yes. That is because the shell expands wildcards (e.g. "*")
characters before invoking the command. The command doesn't have any
way of knowing if the result was a wildcard expansion from the shell
or an explicit command from the user. They are both simply characters
in the program argument list.
> It seems to me that chown should not think that something in the directory
> is a command option.
What you are asking for is not possible. For example if you create a
file name "--verbose" and then tried to use 'rm' to remove the file
and rm refused to remove it because it is also a command line option
you would have the same problem in reverse.
If you want to avoid a program argument being interpreted as an option
then you must tell the command that you are done passing options.
chown USER:GROUP -- --exclude
Or prefix the filename with ./ to avoid it starting with the --option
prefix.
chown USER:GROUP ./--exclude
These rules apply to all of the utilities.
Hope this helps,
Bob