Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to find owner of file or folder?



Excellent! I knew there had to be a better way. Thanks, Peter.

Here's a little script I wrote up which will show the owner if just
one argument is given, or will shown the owner and filename if more
than one argument is given:

#!/bin/zsh

zmodload -F zsh/stat b:zstat

# if there's just one argument given, show the owner and exit
if [ "$#" = "1" ]
then
		zstat -s +uid "$@"
		exit
fi		

# otherwise, loop through and shown the owner for each file which exists
for F in $@
do

	[[ -e "$F" ]] || continue

	echo -n "$F: "
	zstat -s +uid "$F"

done



Messages sorted by: Reverse Date, Date, Thread, Author