Peter,
On 2006 May 9 , at 12.18, Peter W. Draper wrote:
> that is a good idea, but "which" isn't standard and what's more
> seems broken on Solaris and Tru64 (these fail to return a bad
> status when the command isn't found).
Ah yes, I remember that. That's bitten me before.
> SUSv3 defines "command -v" that may solve this issue, but I don't
> think that's POSIX, so anyone know a platform where that would
> fail? I've attached my version of this script.
OK -- here's another go, attached. This execs the first command it
finds in the PATH, or HTX_BROWSER if that's executable. It works
through the path by hand, so is free of any which/command portability
problems.
It also execs the command directly, so that the script can be invoked
as if it were the browser, rather than via a separate call. Thus
code which wants to call it can just call $STARLINK/bin/default-
browser (or whatever) directly, rather than running this script to
determine a browser and then invoking the result.
Mind you, I can't now recall the precise context in which HTX_BROWSER
was dereferenced in the past, so this might be inappropriate.
Howzat?
Norman
--
------------------------------------------------------------------------
----
Norman Gray / http://nxg.me.uk
eurovotech.org / University of Leicester, UK
|