Re: KSH: Alternative shell interpreter path ?
From: Ed Morton (morton_at_lsupcaemnt.com)
Date: 06/24/05
- Next message: Ed Morton: "Re: How to fetch the date of all files in a directory"
- Previous message: Netocrat: "Re: Replace symbolic link by bash script"
- In reply to: Jeremiah DeWitt Weiner: "Re: KSH: Alternative shell interpreter path ?"
- Next in thread: Michael Tosch: "Re: KSH: Alternative shell interpreter path ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 24 Jun 2005 14:10:47 -0500
Jeremiah DeWitt Weiner wrote:
> Thorsten Knopel <to_stupid@gmx.de> 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:
>
> #!/bin/sh
>
> PATH=$PATH:/opt/bin
> if [ -z "$IN_KSH" ] ; then
> IN_KSH=true exec ksh $0 $@
> else
> (real code goes here)
> fi
>
> 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.
I suspect it'll also have a problem with quotes around arguments
disappearing on the exec, e.g. <script "abc def"> (calling script with
one argument "abc def") will become <ksh script abc def> (calling script
with 2 arguments "abc" and "def").
Ed.
- Next message: Ed Morton: "Re: How to fetch the date of all files in a directory"
- Previous message: Netocrat: "Re: Replace symbolic link by bash script"
- In reply to: Jeremiah DeWitt Weiner: "Re: KSH: Alternative shell interpreter path ?"
- Next in thread: Michael Tosch: "Re: KSH: Alternative shell interpreter path ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|