#!/bin/ksh # Define that this script can only be executed # in a directory where it is considered safe to run it!!! # ALLOWED_DIR=/home/z3jxk cd ${ALLOWED_DIR} if [ "$?" != "0" ] then echo cd to $ALLOWED_DIR failed, exiting immediately exit 1 fi # Read input file one line at a time.. # cat fileList.txt | while read line do # # Find user id of file from current line # USER_ID=`echo $line |awk '{print $3}'` # # look up numerical user id of current user # NUM_USER_ID=`grep "^${USER_ID}" /etc/passwd | awk -F: '{print $3}'` # # Find name of current file # FILE_ID=`echo $line |awk '{print $NF}'` # # Specify action for current file # when owned by a defined numeric user id # case $NUM_USER_ID in 0) echo change $FILE_ID to be owned by 17190 # chown 17190 $FILE_ID ;; 101) echo change $FILE_ID to be owned by 1890 #chown 1890 $FILE_ID ;; 442) echo change $FILE_ID to be owned by 3852 #chown 3852 $FILE_ID ;; 671) echo change $FILE_ID to be owned by 1264 #chown 1264 $FILE_ID ;; *) echo num user id $NUM_USER_ID not specified for change, file $FILE_ID not affected;; esac done