Whats wrong in this Script ???

PATH="/clocal/mqbrkrs/user/mqsiadm/sanjay"
MAIL_RECIPIENTS="xyz@abc.com"
Subject="File accessed in last minutes:"

find $PATH -type f -amin -1 > temp.txt.$$
cat temp.txt.$$ | \
while read line
do
fuser -uV $line >> tempmail.txt
done

cat "$tempmail.txt" | mailx -s "$Subject" $MAIL_RECIPIENTS
rm temp.txt.*

This script is giving Errors like when i run this script:
AccessMonitor_Script[7]: find: not found.
AccessMonitor_Script[8]: cat: not found.
AccessMonitor_Script[14]: cat: not found.
AccessMonitor_Script[14]: mailx: not found.
AccessMonitor_Script[15]: rm: not found.

Do you have any Idea about this ??

Thanks!!

Remember that the variable "PATH" is "reserved" for the system! With your PATH assignation you're breaking your environment!

Try changing the variable "PATH" with "MYPATH" and retry :slight_smile:

PATH=........ is not enough you must export your path.
PATH=....
export $PATH after this you can change your environment

ITYM export PATH

Thanks for the Reply !
Ya i got it !! :slight_smile:

I want to ask one thing in that ...
here i have written a line using command fuser, its not working for some file but its working for directory. Do you have any idea about this command.
I have looked into man fuser, which shows ProcessNumber and the user name (-c) who has accessed that.

Thanks !!