| date | published | categories | tags | |||
|---|---|---|---|---|---|---|
2023-09-08 |
true |
notes |
|
The most popular Unix/Linux shell in use, and the default for most Linux distributions. This document will include history, configuration, tips, and tricks.
Bash, when run as a POSIX ([[Unix]]) shell, will only source /etc/profile and then ~/.profile.
When run normally, it will source several files:
As a login shell:
- System-wide config:
-
/etc/profile(which itself will likely execute every script in/etc/profile.d/) - Current-user config: (the first, and only first, of these files it can read:)
~/.bash_profile~/.bash_login~/.profile
As an interactive non-login shell, it will instead read:
/etc/bash.bashrc~/.bashrc
When logging out, it will read:
~/.bash_logout
When run as a non-interactive, non-login shell, like as a script, it will read $BASH_ENV, and execute the file name found there.
You can find the first matching file with a wildcard if you use parens when assigning it to a variable:
ch=(/bin/ch*)
echo $ch
# prints /bin/chattr