views:

38

answers:

2

We have few executable which need some environment setting. We manually running those scripts before running the executable

Like

$ . setenv.ksh

We have to encompass call these in one script to avoid the manual work. We written a sh script like

#!/bin/sh

. setenv.ksh

./abc &

Still the environments are not setting in that session. I think the “. setenv.ksh” runs with fork and it’s not setting the environment.

Please me to solve this problem. Which command we use to run the setenv.ksh so, this will work fine.

Thanks

+1  A: 

In setenv.ksh, you need to export all environment variables you set so that any sub-shell will inherit the values:

export MYENV=myValue
Benoit Thiery
Setenv.ksh is the third party file. We can not edit it otherwise face problem on the installed system.
Saurabh01
Setenv.ksh doing export..
Saurabh01
+1  A: 

I notice the environment script is called setenv.ksh but you try to run it from /bin/sh. Maybe your system has a shell other than ksh as /bin/sh and it misparses something it setenv.ksh. Try changing the shebang line to #!/bin/ksh (or whatever the path to ksh is on your system).

Gilles