Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ksh script 1

Status
Not open for further replies.

smacattack

Technical User
Jun 25, 2001
102
GB
Trying to run a script from a 3rd party application.
When execute script from command line works fine, runs in ksh enviroment using typset function.

When running through third party application fails
typset not found & integer: not found.

First line of script is #!/usr/bin/ksh

tried to echo $SHELL in script but nothing appears.

Any other ways of forcing the ksh enviroment.

thanks

 
The #!/usr/bin/ksh will force the script to run in the Korn Shell... Try echoing $PATH in the script from command line and from the application.
 
/tpp/oracle/general/9.2.0/bin:/tpp/oracle/general/6.0.8/bin:/usr/bin:.:/usr/local/bin:/opt/bin

This is the $PATH echo from the script when executed from the application.

/usr/bin on path is there anything missing to affect ksh ?

thanks
 
It's possible that the application explicitly runs it using Bourne shell, e.g. /bin/sh scriptname, in which case something like this at the beginning of the script might do the trick:

Code:
#!/bin/ksh

if ps -o comm -p $$ | grep ksh > /dev/null
then
        continue
else
        exec ksh $0
fi

echo a korn shell script, $(echo "which won't work under sh")

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top