Re: shell script to change permissions
Re: shell script to change permissions
- Subject: Re: shell script to change permissions
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 31 Jul 2008 15:20:54 -0400
On Thu, Jul 31, 2008 at 2:57 PM, Christopher Nebel <email@hidden> wrote:
> cd foo && ( chown -R me . ; chmod -R a=rwx . )
If you aren't explicitly taking advantage of the "parens make a
subshell" feature, braces work for grouping, too, and are arguably a
better indicator of intent. You do need a semicolon before the
closing brace if it's on the same line, however:
cd foo && { chown -R me . ; chmod -R a=rwx . ; }
You might prefer to continue chaining with && ; in this case, that
would mean that the chmod won't run unless the chown succeeds:
cd foo && chown -R me . && chmod -R a=rwx .
Note that you don't need any grouping in that case.
All of these sequences of commands will leave foo as the current
working directory at the end. If they are the entirety of the script,
no big deal, but if there's more shell to come, you can revert to the
previous working directory by putting the whole thing in (another set
of) parens.
(cd foo ...) pwd # no longer in foo here
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden