First login process name seems to be set to -bash, but if I subshell then it becomes bash. for example:

root@nowere:~# echo $0
root@nowere:~# bash
root@nowere:~# echo $0

-bash is causing some scripts to fail, such as . /usr/share/debconf/confmodule

exec /usr/share/debconf/frontend -bash
Can't exec "-bash": No such file or directory at /usr/share/perl/5.14/IPC/Open3.pm line 186.
open2: exec of -bash failed at /usr/share/perl5/Debconf/ConfModule.pm line 59

Anyone know the reason why $0 is set to -bash?

  • 1
    @RaduRădeanu Useless Use of Cat spotted! Oct 30, 2013 at 14:52

1 Answer 1


If the output of echo $0 command is -bash it means that bash was invoked as a login shell. man bash says somewhere at line 126:

A  login shell is one whose first character of argument zero is a -, or 
one started with the --login option.

See more about here: Difference between Login Shell and Non-Login Shell.

So your shell is still /bin/bash (this can be checked with echo $SHELL command) and I suggest you to use that command which give you error as normally:

exec /usr/share/debconf/frontend bash
  • Thanks, it does appears that login is correctly adding the "-" to the login shell process name. That answers my question. Oct 30, 2013 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.