Timeline for Find out what scripts are being run by bash at login
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 8, 2023 at 23:48 | comment | added | dashesy | works great in most environments and quite useful | |
| Jun 9, 2022 at 19:02 | comment | added | Rodriguez | This was the only solution that worked for me (Using bash in Alpine linux). | |
| Apr 12, 2022 at 5:33 | comment | added | G-Man Says 'Reinstate Monica' |
(Cont’d) … A slightly better approach would be to use -v and see the literal contents of the initialization files — that will show comments, and many system shell script files have header comments giving their names. … … … … … … … … … … … … … … … … … … … … P.S. You talk about “the source command or the . alias.” I believe that there is a command that simply has two names. Can you provide a reference for your claim that . is only an alias for source?
|
|
| Apr 12, 2022 at 5:33 | comment | added | G-Man Says 'Reinstate Monica' |
This is only half of a good idea. Yes, -x will show all the commands that the shell executes, but the OP is interested in the initialization files that bash runs automatically, and -x does not show these as source or . commands. A better answer would be to tell the OP to look at the full -x output, figure out what commands are being executed, and then grep everything to find out what files those commands are in. … (Cont’d)
|
|
| Aug 12, 2021 at 9:29 | history | edited | Naomi | CC BY-SA 4.0 |
added 16 characters in body
|
| Jul 31, 2021 at 18:30 | comment | added | ikaerom |
@smac89 if you want your strace to work on WSL as well, use the following strace -e trace='openat' -e signal=none bash -lic exit 2>&1 | cut -d\" -f2 | grep -Ev "locale/|langpack|/dev/null|/dev/tty|^*/$|+++ exited|logout|.*so.*" to get the proper list of config files only, without the fancy stuff.
|
|
| Apr 13, 2021 at 19:30 | comment | added | smac89 |
I can't get this to work. Try this instead /bin/bash -lixc exit 2>&1 | awk 'match($0, /^+* (\.|source) (.+)/, s) {print s[2]}'. I also find that strace does a better job: strace -t -e trace='openat' --decode-fds -e signal=none bash -lic exit 2>&1 | grep -P --no-color 'openat.+(?<!\(No such file or directory\))$'
|
|
| Jan 27, 2021 at 16:32 | history | edited | Naomi | CC BY-SA 4.0 |
added 62 characters in body
|
| Jan 27, 2021 at 16:07 | review | First posts | |||
| Jan 28, 2021 at 11:01 | |||||
| Jan 27, 2021 at 16:00 | history | answered | Naomi | CC BY-SA 4.0 |