

Bash Initialisation Files - ColinWright
http://www.solipsys.co.uk/new/BashInitialisationFiles.html?HN0811

======
ColinWright
Prompted to submit this because of this item:

<http://news.ycombinator.com/item?id=4369485>

------
hythloday
This is a great start but I'd love to know e.g. exactly what qualifies as a
login shell and what calls the shell with these various arguments.

~~~
mikelward
Any shell started with a minus as the first character of argv[0] is a login
shell e.g. "-bash" is a login shell.

Many things start your shell this way:

    
    
      * the "login" command
        e.g. logging on an a virtual console
      * "su -"
      * "sshd"
        e.g. ssh <hostname>
      * xterms, depending on the settings
        e.g. the original xterm if you run "xterm -ls"
        or you run "xterm" with "xterm*loginShell: true"
        in your ".Xdefaults" or ".Xresources"
      * some X initialization scripts,
        e.g. when logging in to a "Default" session via gdm or kdm
       (how exactly this works depends on your distribution
        some explicitly source .profile instead)
    

With "bash" you can also manually create a login shell using "bash -l" or
"bash --login".

~~~
ralph
Also sudo.

    
    
        $ sudo -i
        # tr \\0 \\n </proc/$$/cmdline
        -bash
        #

------
gosub
It would be very cool if there was a similar graph for the entire boot
process: from grub to init to rc.d/systemd to login to bash.

~~~
planckscnst
You can use

    
    
        systemctl dot
    

It shows the dependency graph of your unit files.

~~~
keeperofdakeys
It should be noted this is for systems that use Systemd, which as far as I'm
aware of, is only Fedora at this stage.

~~~
mrud
OpenSuse also ships with systemd per default. Other distributions like Arch or
Debian support systemd as well.

<http://www.bootchart.org/> is also quite interesting to understand the boot
process better and profile it.

~~~
keeperofdakeys
Ah, I had a suspicion OpenSuse would, as it follows Fedora quite closely.
Bootchart is also quite interesting.

------
rbanffy
I'm with Henry Spencer on this.

"Those who don't understand Unix are condemned to reinvent it, poorly."

------
sciurus
If you want to understand this more, read "Bash Startup Files" and
"Interactive Shells" from the Bash Reference Manual.

[http://www.gnu.org/software/bash/manual/bashref.html#Bash-
St...](http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-
Files)

[http://www.gnu.org/software/bash/manual/bashref.html#Interac...](http://www.gnu.org/software/bash/manual/bashref.html#Interactive-
Shells)

------
Kenan
So where does Git Bash for Windows fall into here?

