[rhn-users] Running korn scripts on RH
Corné Beerse
cbeerse at lycos.nl
Tue Nov 16 09:36:17 UTC 2004
Eric Van Steenbergen wrote:
> Hello all,
>
>
>
> I’ve made some scripts to use on different UNIX platforms. All commands
> are tested on AIX, UnixWare 7.1.1 and RedHat Linux ES. The commands work
> perfect and give back the expected results. But…. When I copy the entire
> script to a RedHat server, make it executable (chmod +x) and try to run
> it I get the error: : bad interpreter: No such file or directory. Can
> anyone tell me what I forgot or did wrong?
My first impression it is in the definition of the interpreter in the first
line: It starts with '#!' and is followed by the absolute path to the
interpeter, in your case most likely '/bin/ksh' or '/usr/bin/ksh'.
- check to see if ksh is realy there (can be a softlink)
- check to see if it realy is a kornshell.
For compatibility, this interpreter is allowed only one parameter, separated by
a single space.
My idea: if possible use '#!/bin/sh' for scripts, unless you realy need some
advanced features and are sure the interpreter is there on all systems.
Check to see if it is genuine ascii in the first line. Multy-language caracters
are most times not that well supported.
By default, this first line is interpreted by the kernel. However, a lot of
current shells do interpret the line to see if they can just fork themselfs and
not have to exec a new interpreter. I can imagine some flaws in this: if ksh
is also your login shell, try to start the script from a csh variant (like
`tcsh`) and see if it makes a difference.
In the end, you can always force the shell by invoking the interpreter manually:
`ksh script` or such.
CBee
More information about the rhn-users
mailing list