man bash
says,
A login shell is one whose first character of argument zero is a -, or
one started with the --login option.
When we invoke a terminal such as mintty -
on Cygwin, we can see a single hyphen (-
) from $0.
$ echo $0
-bash
But if we invoke a login shell with --login
option, we can not see -
.
$bash --login
$echo $0
bash
My questions are:
What is the role of
-
? Although we can not see it on login shell invoked--login
, we can check shell's type by just querying related shell options likeshopt -q login_shell
. What is it for?If there is an important role of
-
, why we can not see it on login shell invoked with--login
?How can we invoke a login shell manually whose zero argument starts with
-
?It is the case for other shells as such zsh, csh?