Re: KSH: Alternative shell interpreter path ?
From: Jeremiah DeWitt Weiner (jdw_at_panix.com)
Date: Fri, 24 Jun 2005 16:23:03 +0000 (UTC)
Thorsten Knopel <email@example.com> wrote:
> i like to use a ksh script on difference System e.g. Linux and UnixWare.
> On both systems the shell has another path. for example for Linux
> :/opt/bin/ksh and for UnixWare /bin/ksh.
Run your script using /bin/sh, which is always guaranteed to be
there. Then, inside your script, exec the script with ksh. You have to
be a little careful that the script doesn't end up in an infinite loop,
but you can do it something like this:
if [ -z "$IN_KSH" ] ; then
IN_KSH=true exec ksh $0 $@
(real code goes here)
Warning - this code is not very well tested, and is not guaranteed to
work! In particular, I don't know what the limitations of UnixWare's
/bin/sh might be.