[NTLUG:Discuss] Listing file permissions in "chmod format"
Ben Weatherall
BWeatherall at pdxinc.com
Thu Apr 15 23:42:47 CDT 2010
It sounds like you will be using grep, tr, cut and maybe other commands from within your script. You did not say if they were all on the same H/W platform type, but be aware that not only the command options, but the available shells also differ across platforms.
Scripter beware...
Sent from my HTC on the Now Network from Sprint!
----- Reply message -----
From: "Leroy Tennison" <leroy_tennison at prodigy.net>
Date: Thu, Apr 15, 2010 23:32
Subject: [NTLUG:Discuss] Listing file permissions in "chmod format"
To: "NTLUG Discussion List" <discuss at ntlug.org>
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.
_______________________________________________
http://www.ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list