小编Dre*_*rew的帖子

为什么 /etc/profile.d/ 中的脚本被忽略(系统范围的 bash 别名)?

我是 Ubuntu 的新手。我正在运行 13.10 桌面版。

我想为 bash 设置一些系统范围的别名和自定义提示。我找到了这篇文章:

https://help.ubuntu.com/community/EnvironmentVariables

按照本文中的建议,我创建了 /etc/profile.d/profile_local.sh。它归 root 所有,并且与那里的其他脚本一样具有 644 的权限:

root@ubuntu:/etc/profile.d# ll
total 28
drwxr-xr-x   2 root root  4096 Mar 23 08:56 .
drwxr-xr-x 135 root root 12288 Mar 23 09:15 ..
-rw-r--r--   1 root root   660 Oct 23  2012 bash_completion.sh
-rw-r--r--   1 root root  3317 Mar 23 07:36 profile_local.sh
-rw-r--r--   1 root root  1947 Nov 23 00:57 vte.sh
Run Code Online (Sandbox Code Playgroud)

我进一步确认 /etc/profile 调用 /etc/profile.d。它包含以下代码块:

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if …
Run Code Online (Sandbox Code Playgroud)

bash login .profile

75
推荐指数
2
解决办法
11万
查看次数

标签 统计

.profile ×1

bash ×1

login ×1