- Bash Reference Manual - GNU
- What is the difference between interactive shells, login shells, non-login shell and their use cases?
- Difference between Login Shell and Non-Login Shell?
- Cygwin Bash.exe vs. mintty.exe
- If you run
bash.exeormintty.exewithout options, you just get the naked shell, with its default configuration, which means it doesn’t do things like add the Cygwin/binto yourPATH.
- If you run
-
interactive/non-interactive
- An interactive shell reads commands from user input on a tty. Among other things, such a shell reads startup files on activation, displays a prompt, and enables job control by default. The user can interact with the shell. login/non-login
-
A login shell is one whose first character of argument zero is
-, or one invoked with the--loginoption. -
When Bash is invoked as an interactive login shell, or as a non-interactive shell with the
--loginoption, it first reads and executes commands from the file/etc/profile, if that file exists. After reading that file, it looks for~/.bash_profile,~/.bash_login, and~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. When a login shell exits, Bash reads and executes commands from the file~/.bash_logout, if it exists.
本文详细解析了Bash中登录壳与交互式壳的区别及其应用场景,阐述了它们如何读取配置文件及环境变量的加载过程。此外,还对比了Cygwin Bash.exe与mintty.exe的主要差异。
463

被折叠的 条评论
为什么被折叠?



