使用python中的子进程调用bash时缺少别名设置

2024-10-02 02:38:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我在/etc/profile.d/

# default_dba.sh
if  groups | grep -qw "dba" ;
 then 
if [ $USER != "oracle" ]; then
. /u00/scripts/oracle_alias
fi
fi

如果LDAP用户是dba组的成员,scip将设置别名。 这很管用。 LDAP用户启动一个python脚本。 最后一步,python脚本调用一个新的bashshell

^{pr2}$

在shell会话中,缺少特殊别名(由/u00/scripts/oracle_alias脚本创建),只有默认的操作系统别名。在

我可以在不为LDAP用户创建主目录的情况下解决这个问题吗?在


Tags: 用户脚本defaultifshscriptsetcalias
1条回答
网友
1楼 · 发布于 2024-10-02 02:38:35

当shell/etc'文件在shell/etc'下被调用时…/etc。例句:bash-l

有关更多详细信息,请参见manbash下的“调用”部分。在

代码段(来自手册页)

When  bash  is  invoked  as  an  interactive  login  shell, or as a non-interactive shell with the  login option, 
it first reads and executes commands from the file /etc/profile, if that file exists.  
After reading that file, it looks for ~/.bash_profile,  ~/.bash_login, and ~/.profile, in that order,
and reads and executes commands from the first one that exists and is readable.
The  noprofile option may be used when the shell is started to inhibit this behavior.

相关问题 更多 >

    热门问题