[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: get file mode
From: |
David T-G |
Subject: |
Re: get file mode |
Date: |
Mon, 25 Nov 2002 22:42:33 -0500 |
User-agent: |
Mutt/1.4i |
Arrigo --
...and then Zanette Arrigo said...
%
% I' ve a simple question.
Hmmm... That doesn't sound much like a bug report, then. This list is
really for bug reports for the GNU fileutils package. However, since
we're here...
% There is a way to get the file mode (octal or text)?
There are lots of ways. I don't know of a single utility which
specializes in doing that, but the information is easily obtainable
through other simple UNIX tools doing what *they* do best.
You could use ls (hey, I had to stay SOMEWHAT on-topic) with -l and use
cut, awk, sed, or who knows what else to pull out the first field and
then do a little parsing (or maybe something about like '-rwsr-x--x' is
"text" enough for you).
You could use something like perl to stat() the file and report the
answer (if you're writing a perl script).
You could use perl anyway, all in a one-line shell script call (if you're
writing a shell script).
You could write a little C code to do your stat and return the results
however you wish.
I'm sure there are other ways, but my one minute is up.
% I think it would be very useful (I'am writing a script where it would be very
% useful).
Then just put one of the many tools at your disposal to work :-) It all
depends on the level of portability you need and how you want to get the
data.
%
% Thanks,
%
% Arrigo Zanette
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) address@hidden * society and not sufficient moral courage.
(work) address@hidden -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
pgp35eljiXJ8H.pgp
Description: PGP signature