OpenSSH 3.7 testing (Re: 3.6p1 bug on SCO OpenServer)

Thomas Binder binder at arago.de
Mon Sep 15 19:30:10 EST 2003


Hi!

On Mon, Sep 15, 2003 at 02:50:00PM +1000, Darren Tucker wrote:
> > +       if [ -e regress/Makefile ]; then \
> >              ^^
> > -e is not portable.
> 
> Oops.  Is there a portable equivalent?

I usually use

if ls file-to-test >/dev/null 2>&1
then
	[...]
fi

for that, though it's a lot slower as it needs to run an external
command.

But aside from that, is -e actually what you want to use here? It
would also report OK for a directory, a fifo or a device named
Makefile (though you might consider that nitpicking). Wouldn't

[ -f regress/Makefile -a -r regress/Makefile ]

do what you want? -f reports OK for symlinks to a file as well, at
least with bash, Solaris /bin/sh and IRIX /bin/sh.


Ciao

Thomas




More information about the openssh-unix-dev mailing list