Subject: Re: use of [ -e ${file} ]
To: Roland Illig <roland.illig@gmx.de>
From: Georg Schwarz <geos@epost.de>
List: tech-pkg
Date: 05/22/2004 16:53:14
> Georg Schwarz wrote:
> > Does anyone know where exactly the ./work/.INSTALL and ./work/.DEINSTALL
> > scripts come from for openssl, i.e. where this would have to be changed?
> > 
> > -f has the disadvantage, IMO, that it does not match for symlinks.
> 
> The "test -f foo" on Debian GNU/Linux calls stat, not lstat, so there's
> no problem here. What's on other systems?

NetBSD and IRIX also do. I'm too lazy to boot up my other machines, but I
assume all will do.

> 
> So 'test -f "$file" -o -d "$file"' should in most cases be as good as
> 'test -e "$file"'.

except for special files such as /dev entries

In most cases the author of the script should have an idea whether to check
for a file or a directory and use only that one.

-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 geos@epost.de     +49 177 8811442