我有一个shell脚本来设置一些环境变量并启动作为参数发送的任何程序:
export PATH=$HOME/local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
export TESTER="MY TEST VAR"
$@
bash
例如,当我用它来调用它时:
kjfletch@flatbed:~$ envrun.sh bash
kjfletch@flatbed:~$ echo $LD_LIBRARY_PATH
/home/kjfletch/local/lib:
kjfletch@flatbed:~$ echo $TESTER
MY TEST VAR
当我使用它来调用终端(xterm
,aterm
,...)我LD_LIBRARY_PATH
得到取消设置:
kjfletch@flatbed:~$ echo $LD_LIBRARY_PATH
kjfletch@flatbed:~$ echo $TESTER
MY TEST VAR
为什么会这样?我该如何阻止?(我正在运行Debian 5.0)
更新资料
我的终端没有调用bash作为登录名:
kjfletch@flatbed:~$ echo $0
bash
我LD_LIBRARY_PATH
没有出现在任何bash启动文件中(除了.bash_history和〜/ .profile不存在。):
kjfletch@flatbed:~$ grep "LD" ~/.bash*
kjfletch@flatbed:~$ grep "LD" /etc/bash.bashrc
kjfletch@flatbed:~$ grep "LD" /etc/profile