I have used stat because it is simple to store the information in variables: eval `stat -c 'MODE="%A";OWNER="%U";GROUP="%G"' afilenamegoeshere` echo $MODE $OWNER $GROUP Matt On Thu, 2006-09-07 at 05:26 -0400, Michael Velez wrote: > > > -----Original Message----- > > From: redhat-list-bounces@xxxxxxxxxx > > [mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Martin Thoma > > Sent: Thursday, September 07, 2006 3:36 AM > > To: General Red Hat Linux discussion list > > Subject: Shell command to retrieve file ownership of a determed file > > > > Hi > > > > I am writing a shell script that is verifies ownership and > > the file access permissions of selected files. Is there a > > tool that allows me to retrieve the uid,gid and mode directly > > instead of 'ls -l | grep <filename> | cut -d" " ...'? > > > > Thanks for a hint. > > > > Cheers Martin > > The best thing I know of is not too much different from what you have: > > ls -l <filename> | awk '{print $1}' > ls -l <filename> | awk '{print $3}' > ls -l <filename> | awk '{print $4}' > > or ls -l <filename> | awk '{print $1" "$3" "$4}' > > Michael > -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list