nice new tool to show version of feisty meow
[feisty_meow.git] / scripts / files / find_non_owned.sh
1 #!/bin/bash
2 if test $# = 0; then
3   echo $(basename $0): needs at least one directory name as a parameter.
4 #hmmm: set the first parm to . instead.
5   \exit 1;
6 fi;
7 export outfile="$(mktemp "$TMP/zz_findertmp.XXXXXX")"
8 # check for files not owned by the user.
9 echo "These files are not self-owned by $USER:" >$outfile
10 for i; do
11   find $i ! -user $USER >>$outfile
12 done
13 # check for files not in same group as the user.
14 GROUP="$(groups | awk '{print $1}')"
15   # assumption above that the first group is the 'primary' one.
16 echo "These files are not owned by primary group of $GROUP:" >>$outfile
17 for i; do
18   find $i ! -group $GROUP >>$outfile
19 done
20
21 less $outfile
22
23 rm $outfile
24