Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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".


Also sudo.

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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: