尽管我在其中添加了一些命令,但每次重启后.bashrc
我都必须说“ ”。source ~/.bashrc
.bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH=/opt/scala/sbt-0.12.2/bin:$PATH
如果不说“ souce ~/.bashrc
”,命令sbt
就不起作用。
No command 'sbt' found, did you mean:
Command 'st' from package 'suckless-tools' (universe)
Command 'sb' from package 'lrzsz' (universe)
Command 'mbt' from package 'mbt' (universe)
Command 'sbd' from package 'cluster-glue' (main)
Command 'sb2' from package 'scratchbox2' (universe)
Command 'skt' from package 'latex-sanskrit' (universe)
Command 'sbmt' from package 'atfs' (universe)
Command 'lbt' from package 'lbt' (universe)
sbt: command not found
答案1
一些基础知识:.bashrc
用于交互式非登录shell,而~/.bash_profile
用于交互式登录shell。
为了
交互式非登录shell,初始化顺序:系统范围的bashrc(SYS_BASHRC)默认
/etc/bash.bashrc
=>~/.bashrc
交互式登录shell,初始化顺序:
/etc/profile
[^sysconfdir] =>~/.bash_profile
=>~/.bash_login
=>~/.profile
。
Ubuntu 默认使用~/.profile
来加载~/.bashrc
(如果~/.bash_profile
存在),~/.profile
并且~/.bashrc
不会在 shell 初始化时加载。
因此,请确保您没有~/.bash_profile
,将您想要的内容放入~/.profile
其中~/.bashrc
。