[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chown and bash trashed part of system
From: |
Vincent Chapman |
Subject: |
Re: chown and bash trashed part of system |
Date: |
Wed, 31 Dec 2008 08:09:21 -0700 |
I understand, but there are still incosistancies in the unix world of
shells. Try this and you'll understand how one(I) could make this
mistake.
$ sudo bash echo .*
. .. .hidden_files
in zsh
$ sudo zsh echo .*
.hidden_files
zsh would not have accended into the parent directories. Bash will.
One would not stop to think that one shell would handle something so
simple as .* differently from other shells. I know assume spells... but
thats what happened.
Regards,
Vincent
On Wed, 2008-12-31 at 00:28 -0700, Bob Proulx wrote:
> Vincent Chapman wrote:
> > $ sudo chown -R vincent:vincent *
>
> When using -R and other commands in recursive mode you generally don't
> want to use '*'. Simply use '.' in that case.
>
> sudo chown -R vincent:vincent .
>
> The command will recurse down '.' directory and do what you wanted.
> That would have included all files hidden and otherwise.
>
> Personally I prefer find in this case.
>
> find . -exec chown vincent:vincent {} +
>
> > changed all but the hidden folders, so did not work for this situation
> > $ sudo chown -R vincent:vincent .*
> > Command very bad.
> > ...
> > Luckily I only messed up three user home directories. Should there be a
> > filter for '..' that prohibts chown from assending towards / ?
>
> Have you ever used a kitchen knife? I can't imagine a kitchen without
> one. Have you ever cut yourself while using a kitchen knife? We all
> have at one time or another. The classic thought experiment (IIRC by
> Andrew Koenig) is to design a kitchen knife that will make it
> impossible to hurt yourself while using it. After having thought
> about the problem and created a design the follow-up question is,
> would you use such a knife in the kitchen yourself?
>
> This is a useful thought experiment that always comes to my mind when
> people try to make it impossible to do bad things because that also
> tends to restrict people from doing good things too.
>
> Bob
>
>
> _______________________________________________
> Bug-coreutils mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-coreutils