![]() |
what is mean "-bash"
hi
what is meaning dash first of bash in outpu `ps -aef | grep bash` command |
It indicates the options given to the command, in that case, ps.
http://linux.die.net/man/1/ps |
Some programs use a style when one dash means a character for an option and two dashes mean one option which is several characters. But some programs take one dash and then an option which can contain several chars. For example:
Code:
feh -FY Code:
feh -F -Y But Code:
find / -iname '*pattern*' |
It would be helpful to see the output that includes "-bash"
|
Bash interprets being invoked with a leading - in its name as the --login option. See the INVOCATION section in the bash manual.
|
Nevermind
|
a simple output on my system (with run command 'ps -aef | grep bash')
kumaas 12582 12580 0 14:08 pts/0 00:00:00 bash kumaas 15784 15776 0 15:59 tty2 00:00:00 -bash root 25736 25728 0 20:54 pts/0 00:00:00 -bash root 26922 25736 0 21:20 pts/0 00:00:00 grep bash in line 2 and 3 bash started with dash but the other two lines do not |
When programs are run on unix systems, they are passed a set of strings. Whatever invokes them builds that set. The shell does it, the login process does it, every program is run by calling some variant of the "exec" system call.
The first of those strings is conventionally the string that was used to invoke the program, but the important thing to understand is that that's only a convention. For instance, here's how you run bash and tell it its name is "hahaha funny": Code:
~/sandbox/49381$ cat >exectest.c |
I vaguely remember that bash processes that show up as -bash in ps output are login shells. Presumably the login binary uses the technique explained by jthill to make it so.
A test has just confirmed that a login shell does indeed show up that way. I had to use a virtual terminal; presumably the bash login process that results from using a graphical login screen hash bash replaced by some other program. |
I misunderstood the question. :redface:
Never noticed that -bash output in ps before. I've still a lot to learn, so much to cram into such a tiny, aging brain. :) |
Quote:
|
All times are GMT -5. The time now is 08:31 PM. |