Re: Newbie administrator
On Thu, Feb 27, 2003 at 04:42:07PM +0800, Robert Storey wrote:
> > find /home -type l -exec chmod 777 {} \;
> Now, one bash question I've been meaning to ask for a long time...
>
> I keep seeing this...
> {} \;
>
> ...on the end of lines in bash scripts. I don't have a good bash book,
> and I don't know what this means, and obviously "man {} \;" isn't going
> to help. Can anyone reveal for thick-headed "programmers" like me what
> that does?
The backslash is the only part of this that is bash-related. From
find(1):
-exec command ;
Execute command; true if 0 status is returned. All
following arguments to find are taken to be argu
ments to the command until an argument consisting
of `;' is encountered. The string `{}' is replaced
by the current file name being processed everywhere
it occurs in the arguments to the command, not just
in arguments where it is alone, as in some versions
of find. Both of these constructions might need to
be escaped (with a `\') or quoted to protect them
from expansion by the shell. The command is exe
cuted in the starting directory.
In bash (at least as shipped by debian), the {} doesn't need to be
escaped, but the ; does.
--
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
- Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)
Reply to: