|
From: | L. A. Walsh |
Subject: | Re: forked before bash subshell |
Date: | Sat, 15 Oct 2016 13:18:39 -0700 |
User-agent: | Thunderbird |
XiaoBing Jiang wrote:
Thank you for your explain!#!/bin/bash (cd /tmp && exec sleep 20) & echo "end" Then, instead of having: $ ./foo end $ ps f -t pts/5 PID TTY STAT TIME COMMAND 7287 pts/5 Ss 0:00 bash 20165 pts/5 R+ 0:00 \_ ps f -t pts/5 20160 pts/5 S 0:00 /bin/bash ./foo 20161 pts/5 S 0:00 \_ sleep 20
---- When I run your program, I get:
./foo; ps f -t pts/3
end PID TTY STAT TIME COMMAND 91677 pts/3 Ss 0:00 -bash 96604 pts/3 R+ 0:00 \_ ps f -t pts/3 96603 pts/3 S 0:00 sleep 20 I don't see a line corresponding to your '/bin/bash ./foo' line. Isn't my output what you show in the next example? Is it what was wanted?
You will have: $ ./foo end $ ps f -t pts/5 PID TTY STAT TIME COMMAND 7287 pts/5 Ss 0:00 bash 20173 pts/5 R+ 0:00 \_ ps f -t pts/5 20172 pts/5 S 0:00 sleep 20 This is what you wanted, right?
[Prev in Thread] | Current Thread | [Next in Thread] |