Shell、bashrc 和 fish
💡
原文英文,约400词,阅读约需2分钟。
📝
内容提要
Bash是Bourne-Shell的替代品,使用时需注意登录shell和非登录shell的配置文件加载顺序。应在~/.bash_profile中引用~/.bashrc。fish shell也值得尝试,但存在一些问题。
🎯
关键要点
- Bash是Bourne-Shell的替代品,称为Bourne-Shell-Again-Shell。
- Bash和其他shell(如dash)在以sh名称调用时会变得更符合POSIX标准。
- 登录shell的配置文件加载顺序为:/etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile。
- 非登录shell的配置文件为:/etc/bash.bashrc -> ~/.bashrc。
- 使用bash作为登录shell时,~/.bashrc不会被加载,需要在~/.bash_profile中引用。
- fish shell值得尝试,但存在一些问题。
❓
延伸问答
Bash和Bourne-Shell有什么关系?
Bash是Bourne-Shell的替代品,称为Bourne-Shell-Again-Shell。
登录shell和非登录shell的配置文件加载顺序是什么?
登录shell的加载顺序为:/etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile;非登录shell为:/etc/bash.bashrc -> ~/.bashrc。
如何在Bash中加载~/.bashrc?
在~/.bash_profile中添加以下行:[[ -f ~/.bashrc ]] && . ~/.bashrc。
fish shell有什么优缺点?
fish shell值得尝试,但存在一些问题。
Bash在以sh名称调用时有什么变化?
当Bash和其他shell(如dash)以sh名称调用时,会变得更符合POSIX标准。
如何区分登录shell和非登录shell?
登录shell通常读取用户的配置文件,而非登录shell则读取不同的配置文件。
➡️