刚刚安装了 Ubuntu 14.04.1 LTS。
根据.profile,
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash, if ~/.bash_profile or ~/.bash_login exists.
Run Code Online (Sandbox Code Playgroud)
没有 ~/.bash_profile 或 ~/.bash_login。
打开终端时似乎没有来源 .profile 。
对于 11.04,我重新安装了我的系统。该安装的一部分是安装rvm,它rvm.sh在/etc/profile.d/. 这不起作用,因为/etc/profile(加载每个 +r in /etc/profile.d/*.sh)没有被加载。根据文档,该配置文件仅在登录时运行 bash 时才来源。为了验证这一点,我调用了bash --login,之后rvm就可用了。
这在没有任何配置的以前版本的 Ubuntu 中对我有用。也就是说,全新安装的 10.10 将正确获取 profile/.d。
我的问题是:我做错了什么,还是在 Natty 中做出的一些新假设破坏了这一点?我目前的解决方法是source /etc/profilein ~/.bashrc(这很糟糕,因为配置文件是在bashrc之前加载的,但可以解决问题)。
我试图区分这四个术语登录、非登录、交互式和非交互式:
据我了解
交互式-非登录shell:启动系统,登录系统并打开终端和
非交互式登录shell:telnet到系统并登录
但是交互式登录外壳呢?
它是否登录系统,打开虚拟终端并登录?和
非交互式 - 非登录 shell,它是否在 crontab 中运行自动脚本?
我使用的是 Ubuntu 14.04。我曾经chsh将默认 shell 设置为/usr/bin/zsh.
我~/.zprofile定义了几个环境变量,例如export EDITOR=vim. 然而,登录并启动 GNOME 终端后,这些变量并未设置。运行后zsh -l,它们是:
% echo $EDITOR
% zsh -l
% echo $EDITOR
vim
%
Run Code Online (Sandbox Code Playgroud)
那么显然,当在zsh登录时运行时,它不知道它是登录 shell,因此不读取.zprofile?是什么赋予了?
据我所知,直到最近这才起作用,然后突然就不起作用了,所以也许升级破坏了某些东西?