Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

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

-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?

share|improve this question
1  
@RaduRădeanu Useless Use of Cat spotted! –  gniourf_gniourf Oct 30 '13 at 14:52

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
Thanks, it does appears that login is correctly adding the "-" to the login shell process name. That answers my question. –  James Shimer Oct 30 '13 at 17:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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