[NTLUG:Discuss] Listing file permissions in "chmod format"
Leroy Tennison
leroy_tennison at prodigy.net
Thu Apr 15 22:37:45 CDT 2010
The issue I'm facing is that I'm writing a script which will be used by
others on hosts where I have no access or knowledge of the specifics. I
know I need to modify a file which I have seen is read-only (444) in one
case. What I want to do is:
"capture" the current permissions in a form usable by chmod
chmod a+w {file}
cat {file} | sed (script) > {newfile}
mv {file} {file}.{date}
mv {newfile} {file}
chmod (saved permissions) {file}
"man ls" didn't provide any other program in the "See also" category.
Searching the web produces all kinds of references to ls and a reference
to a Perl script. I really don't want to use Perl because, again, I
don't know much about the hosts the script will run on and don't want to
assume that Perl is universally available.
Any ideas or solutions would be appreciated.
More information about the Discuss
mailing list