[NTLUG:Discuss] Listing file permissions in "chmod format"
Robert Citek
robert.citek at gmail.com
Sat Apr 17 13:05:06 CDT 2010
On Fri, Apr 16, 2010 at 8:08 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Apr 16, 2010 at 08:06:16AM -0500, Patrick R. Michaud wrote:
>> cat {file} | sed {script} > {newfile}
>> chmod {newfile} --reference={file}
>> mv {file} {file}.{date}
>> mv {newfile} {file}
>
> Oops, that second line should probably be
>
> chmod --reference={file} {newfile}
And to tighten it up a bit:
mv {file} {file}.{date}
sed {script} {file}.{date} > {file}
chmod --reference={file}.{date} {file}
chmod a+w {file}.{date}
and on SunOS:
mv {file} {file}.{date}
sed {script} {file}.{date} > {file}
chmod $(stat -c %a {file}.{date}) {file}
chmod a+w {file}.{date}
And if you don't really need {file}.{date} to be writable, you can
drop that last line.
Regards,
-Robert
More information about the Discuss
mailing list