I am trying to write a script to track the progress of file change.
I have the following till now:
#!/bin/sh
old=‘ls -l /tmp/file‘
new=‘ls -l /tmp/file‘
while [ "$old" = "$new" ]
do
new=‘ls -l /tmp/file‘
done
echo "The file has been changed"
The above program when run gives the message:
new: command not found
Can someone please help.
Thanks
You probably have space around
=.In shell, when you assign the values you cannot put space around
=:Shell will think: “call MY_VAR with arguments: (‘=’, ‘my value’) “, but wait! I don’t know the command “MY_VAR”!
You need to do it this way:
BTW, consider using
inotifywatchcommand. Here’s example: