[NTLUG:Discuss] Is there a Better way to extract a directory owner's UID/GID?
Patrick R. Michaud
pmichaud at pobox.com
Thu Mar 9 13:06:50 CST 2006
On Thu, Mar 09, 2006 at 12:53:14PM -0600, Richard Geoffrion wrote:
> Issue: Need to change ownership of a file to be owned by the owner of
> the current(or parent) directory
FWIW, many chown commands support a --reference= option:
# change ownership of "file" to match the current directory
chown --reference=. file
# change ownership of "file" to match my home directory
chown --reference=$HOME file
Man chown(1) for more details. On some systems, the chmod(1)
command can also take a --reference= option, to get the permissions
to match.
Pm
More information about the Discuss
mailing list