help with bash script using find and diff command
Posted
by su
on Server Fault
See other posts from Server Fault
or by su
Published on 2010-02-08T01:46:21Z
Indexed on
2010/03/15
14:10 UTC
Read the original article
Hit count: 377
Helloe, i have a bash script that i need help with:
#!/bin/bash
if [ -f "/suid.old" ]
then
find / -perm -4000 -o -perm -2000 ls > suid.old
else
find / -perm 4000 -o -perm -2000 ls > suid.new
diff suid.old suid.new > newchanges.list
fi
when i run it it gives me an error saying: diff: suid.old: No such file or directory.
My script should say, if suid.old does not exist, then use the find command to create one, or else use find command to do whatever it needs to with the suid.new. after find any changes it made and redirect it to newchanges.list
please help,
© Server Fault or respective owner