I have written a simple shell script as follows:
#!/bin/bash
sleep 90
After running this shell I run pstree
in a separate shell to see the process tree structure.
Here is what I see
-gnome-terminal-+-bash---sleepy.sh---sleep
I was expecting this to be like
-gnome-terminal-+-bash---bash---sleep
Why is a shell script being represented as a process by pstree? The ps
command correctly shows the command being executed as
10150 8771 0 08:13 pts/1 00:00:00 /bin/bash ./sleepy.sh
Here the process is bash and sleepy.sh is its argument (this makes sense to me). In my view a process has to be an Executable Linkable Format binary (ELF). Bash is an ELF executable but a shell script is not and hence I think pstree
should not be showing it as such?