What is the difference between bash and -bash. When I execute echo $0
, it returns bash
on one machine and -bash
on the other machine. What is the difference between them?
1 Answer
Processes with a -
at the beginning of arg 0 have been run via login
, or by exec -l
in bash.
-
Thanks :) After reading your answer, I did
help exec
and that reads,If the first argument is '-l', then place a dash in the zeroth arg passed to FILE, as login does.
May 22, 2013 at 8:40
-bash
shell, but I could be mistaken of course.-
in front of its name in $0. If you look at man exec you'll see that you can make $0 be anything you like when you execute bash.