'chown' and hidden directories
Bill Davidson
harley7
Wed Feb 23 11:34:19 PST 2005
On 07:39 Wed 23 Feb , Michael Hipp wrote:
> Even worse, I found out that chown does not behave as (I) expected:
>
> chown -R michael: *
In this example, the shell is expanding * to all files in the current
directory and passing that to chown. Bash hides dotfiles unless the dot is
stated explicitly or the dotglob shell option is set.
I mentioned incorrectly in a previous post that you could use "set -o dotglob"
to change that behaviour. The correct invocation is "shopt -s dotglob" to
allow wildcards to implicitly expand to dotfiles. Use "shopt -u dotglob" to
unset the option.
I've tried this using "ls *" and it doesn't include "." or "..", which is what
you wanted. Although you might not want the extra steps of setting and
unsetting shell options.
> behaves differently than
>
> chown -R michael: /path/to/target
In this case, you're passing a directory to chown and chown is looking inside
that directory. It's not relying on bash to expand a wildcard for it.
> The latter processes dot-hidden directories, the first does not. Perhaps
> this is intentional, but it looks like a bug to me.
>
> Thoughts?
>
> Michael
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
More information about the Linux-users
mailing list