[ ! -e a.log ] & [ ! -f a.log ] difference b/w these two


if [ ! -e a.log ]; then
        touch a.log
fi

...................................

if [ ! -f a.log ]; then
        touch a.log
fi

Hi ,

Are the above two meant for same purpose i.e finding & creating a.log ?

I would really appreciate if you could explain the purpose of " ! " & " -f "
in these .

thanks

Hi,
"Everything is a file..."
but not everything is a regular file.
-e return true (and ! reverse the result) if there exist something named a.log
-f return true (and ! reverse the result) if there is something named a.log and is a regular file,such as a text file or a binary, what most people think of as normal files.

lakris@ubuntu:~$ [ -e /dev/audio ] && echo true
true
lakris@ubuntu:~$ [ -f /dev/audio ] && echo true
lakris@ubuntu:~$

/Lakris