[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: touch: enhancement request to preserve file ownership and permission
RE: touch: enhancement request to preserve file ownership and permissions
Thu, 13 Sep 2007 14:33:19 +0930
should be in this order (can't chmod before you touch):
'touch --ref=reffile yourfile && chmod --ref=reffile yourfile'
but what I really want is to have this:
'touch --ref=reffile yourfile && chmod --ref=reffile yourfile && chown
--ref=reffile yourfile '
OR as suggested:
'touch -pr=reffile yourfile' (cause I'm lazy)
I could use a function like:
touch --ref=$F2 $F1
chmod --ref=$F2 $F1
chown --ref=$F2 $F1
where "touchp a b" creates a new empty file with exactly the same
The purpose of this is to clear a log file like this: "> file" but you have to
be a user with permission to do this and if you're not then "sudo > file"
doesn't work where "sudo mv log log.old; sudo touch -pr=log.log log" will.
From: Eric Blake [mailto:address@hidden
Sent: Thu 9/13/2007 1:50 PM
To: Peter Newman
Subject: Re: touch: enhancement request to preserve file ownership and
-----BEGIN PGP SIGNED MESSAGE-----
According to Peter Newman on 9/12/2007 9:18 PM:
> Add option "-p" to be used only in conjunction with "-r" so that the file
> owner, group and file permissions are "preserved" (copied) from the
> referenced file as well as the timestamp.
How is this different from the current two-step process
'chmod --ref=reffile yourfile && touch --ref=reffile yourfile'?
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----