Can't source file through ENVAR ENV while running a ksh script on Linux box

Document ID : KB000049701
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

The job below attempted to source /home/compops/.profile.esp did not work on Linux agent.

It did work if I sourced the file from a command prompt and then ran the script. The script uses Korn shell

.
LINUX_JOB PERLJOB DOCMEM(N800UNIX)
AGENT LJ_LINUX101
SCRIPTNAME /home/compops/perltest.pl
ENVAR ENV=/home/compops/.profile.esp
ARGS %USER1 %USER2 %USER3
USER compops
RUN DAILY
ENDJOB

Solution:

Investigation found the issue was caused by the difference between two Korn shell versions ksh-93 and ksh-88, namely with ksh-93 the ENV defined file could be read only for interactive shells.

In this case, it meant one could not use the ENV in the jobs if the Linux was set up with ksh93.

Solution options were:

  1. Put the environment variables sourcing into the script instead of set up ENVAR ENV clause in the job definition, or

  2. Use the ksh88