我在我的.bashrc文件中添加了scala,但是当我关闭我的mac并将其重新打开时它没有找到它.当我做
source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)
一切都恢复正常了.我会说问题一般是整个文件,但问题是,我还有其他的东西在之前工作得很好,但问题是scala持续存在.有谁知道这是为什么并解释我为什么会遇到这个问题?这是我的.bashrc文件中的内容,它正确运行rvm和mysql,但不是scala:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/Users/Zeroe/scala-2.9.1-1/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
kev*_*kev 38
我通过添加echo "${BASH_SOURCE[0]}"到这些脚本来弄清楚这个图.
+-----------------+ +------FIRST-------+ +-----------------+
| | | ~/.bash_profile | | |
login shell -------->| /etc/profile |-->| ~/.bash_login ------>| ~/.bashrc |
| | | ~/.profile | | |
+-----------------+ +------------------+ +-----------------+
+-----------------+ +-----------------+
| | | |
interactive shell -->| ~/.bashrc -------->| /etc/bashrc |
| | | |
+-----------------+ +-----------------+
+-----------------+
| |
logout shell ------->| ~/.bash_logout |
| |
+-----------------+
Run Code Online (Sandbox Code Playgroud)
注意
[]-->[]意思是source by workflow(自动).[--->[]意思是source by convention(手工.如果没有,没有任何事情发生.)FIRST 手段 find the first available, ignore rest你的shell可能是一个登录shell,在这种情况下,bash将按顺序读取各种配置文件:
/etc/profile~/.bash_profile~/.bash_login~/.profile通常~/.bashrc从其中一个文件中获取源代码,因此您也可以获得相同的登录shell配置.
这是我的~/.profile内容:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export LANGUAGE="en_US:en"
export LC_MESSAGES="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8405 次 |
| 最近记录: |