开发者

Shell script problem to set my env

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 m开发者_Go百科anual 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


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).


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

export MYENV=myValue
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜