X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Ffiles%2Ffind_non_owned.sh;h=d5818a3d2bb1c531a5cd21138966878ebadbe94e;hb=6511da232065f9fc40a96134686f63f34b88cfb1;hp=8e8ef7d2942dce76abb145c387987f2c393151d9;hpb=2952ccf47b80174880141a7ecfa122089f349b8d;p=feisty_meow.git diff --git a/scripts/files/find_non_owned.sh b/scripts/files/find_non_owned.sh index 8e8ef7d2..d5818a3d 100644 --- a/scripts/files/find_non_owned.sh +++ b/scripts/files/find_non_owned.sh @@ -1,14 +1,24 @@ #!/bin/bash if test $# = 0; then echo $(basename $0): needs at least one directory name as a parameter. +#hmmm: set the first parm to . instead. \exit 1; fi; export outfile="$(mktemp "$TMP/zz_findertmp.XXXXXX")" -echo "These files are not self-owned:" >$outfile +# check for files not owned by the user. +echo "These files are not self-owned by $USER:" >$outfile for i; do find $i ! -user $USER >>$outfile done -cat $outfile - # apparently this utility is supposed to echo to standard out. +# check for files not in same group as the user. +GROUP="$(groups | awk '{print $1}')" + # assumption above that the first group is the 'primary' one. +echo "These files are not owned by primary group of $GROUP:" >>$outfile +for i; do + find $i ! -group $GROUP >>$outfile +done + +less $outfile + rm $outfile