P
P
Pavel Kulaga2020-04-23 16:41:25
*nix-like systems
Pavel Kulaga, 2020-04-23 16:41:25

How does bash keep its name when running a background task in a script?

ls -Ra / &
kill -s TSTP $!
read

If you run the code below in bash as a *.sh file, and then run top, then instead of ls we will see the process as bash.
How does he do it and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Karpion, 2020-04-23
@Karpion

$! = pid of the last process in the background
Well, kill either kills ls, or it's not clear at all, but not bash - because bash is not a background process here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question