Re: KSH: Alternative shell interpreter path ?

From: Jeremiah DeWitt Weiner (jdw_at_panix.com)
Date: 06/24/05

  • Next message: kartik: "How to fetch the date of all files in a directory"
    Date: Fri, 24 Jun 2005 16:23:03 +0000 (UTC)
    
    

    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.

    JDW


  • Next message: kartik: "How to fetch the date of all files in a directory"

    Relevant Pages