Say I have two files:
-rw-rw-r-- 1 webapp webapp 215 Jun 21 2012 index.php
-rw-rw-rw- 1 root root 58 Dec 17 11:02 patch.log
I would like to give patch.log
the same permissions as index.php
.
I can do it manually:
chown webapp:webapp patch.log
chmod 664 patch.log
But this should be part of a script, where I don't necessarily know what the exact permissions of index.php
are.
Is there a way to copy permissions of a given file to another file?