我需要在 CentOS 5.3 集群中调用程序的修改版本/home/user_name/bin
而不是(旧)版本/opt/program_name/current
。该程序使用 python 创建一个 tcsh 脚本,然后执行该脚本。
我可以覆盖 PATH 以在 中调用程序的修改版本~/bin
,以便which program_name
标识到~/bi
n的路径。我已经在这样做了.bashrc
,.profile
,.tcshrc
,和.cshrc
。但是,每次执行 tcsh 时,都会/etc/profile
加载来自的环境变量,并且路径将恢复为/opt/program_name/current
.
这些程序特定的变量在/etc/profile.d/program_name.sh
被调用时设置/etc/profile
:
# /etc/profile
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
Run Code Online (Sandbox Code Playgroud)
因此,当program_name.sh
被调用时,对应的脚本是:
# /etc/profile.d/program_name.sh
setenv PATH ${PATH}:/opt/program_name/current
Run Code Online (Sandbox Code Playgroud)
如何防止/etc/profile
被我的用户帐户访问?
我没有 su 访问权限,其他用户仍在使用旧版本的软件,/opt/program_name/current
因此我无法更新软件或修改其中的设置/etc/profile.d/program_name.sh