| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Usage:
 | 
| 4 | #   demo/bash-startup.sh <function name>
 | 
| 5 | 
 | 
| 6 | set -o nounset
 | 
| 7 | set -o pipefail
 | 
| 8 | set -o errexit
 | 
| 9 | 
 | 
| 10 | # https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
 | 
| 11 | 
 | 
| 12 | # Looks at /etc/profile first, which is documented.
 | 
| 13 | login-shell() {
 | 
| 14 |   strace -e open bash --login
 | 
| 15 | }
 | 
| 16 | 
 | 
| 17 | # Looks at /etc/bash.bashrc first.  How does it find this?
 | 
| 18 | regular-shell() {
 | 
| 19 |   strace -e open bash
 | 
| 20 | }
 | 
| 21 | 
 | 
| 22 | # OK it's in here, but I don't see it documented.  Is it Debian-specific?
 | 
| 23 | 
 | 
| 24 | # In config-top.sh in the bash tree, I see this.  So Debian must turn this on.
 | 
| 25 | #
 | 
| 26 | # /* System-wide .bashrc file for interactive shells. */
 | 
| 27 | # /* #define SYS_BASHRC "/etc/bash.bashrc" */ 
 | 
| 28 | search-bin() {
 | 
| 29 |   strings /bin/bash | grep bashrc
 | 
| 30 | }
 | 
| 31 | 
 | 
| 32 | "$@"
 |