Bash command/script to return group of file
I'm in need of a Bash command or script that will return the group of a file, so that I can store it in a variable.
I'm aware of "ls -g" but that returned: Code:
-rw-r--r-- 1 group 167 Mar 5 11:48 file.txt Should I be using Perl, or I am I stuck with some ugly string concatenation? Thanks for your help! |
If you have awk installed you can do that easily with:
ls -g <filename> | awk '{print $3}' The above will just print out the third field which is always the group with ls -g <filename>. |
Thank you thank you thank you thank you thank you, Mr. Trout.
|
Quote:
Code:
group=$( stat -c %g FILE ) |
All times are GMT -5. The time now is 10:38 AM. |