Login shell vs Interactive Shell

###Bash - login-sh & interactive-sh

login shell

  • what is login shell?
    1
    2
    echo $0
    > -bash (prefix should be '-', this mean bash is login shell)

interactive shell

  • what is interactive shell?
    1
    2
    echo $-
    > 569JNRTXZghilms (you can see 'i', that means it is interactive shell)

the defference between the two shells?

the order of loading profile

  • login shell
    1
    2
    3
    /etc/profile
    ~/.bash_profile
    ~/.profile
  • interactive shell
    1
    2
    /etc/bash.bashrc
    ~/.bashrc

why can I load .bashrc on Ubuntu linux?

because in ~/.profile also source the .bashrc

what kind of shell is neither login-sh nor interactive-sh

shell run in the command scripts.