On Thu, 24 May 2001, Wilbert Berendsen wrote:
> However, when running a command through sh -c, the shell will determine if
> there is a compound command (pipeline or redir.) or not.
>
> If not, sh -c will not spawn a new process for the command, but instead
> replace itself. So:
>
> sh -c 'exec netscape'
>
> yields exactly the same result as:
>
> sh -c 'netscape'
>
> So the shell will not spoil a process if it's not necessary.
I think that is a bash feature. (On some systems /bin/sh is bash.)
But not with ash (standard /bin/sh), csh or ksh.
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND USER PID PPID PGID
SESS JOBC STAT TT TIME COMMAND
reed 6424 0.0 0.4 556 452 p5 I+ 10:59AM 0:00.01 links reed 6424 6423 6423
7a6600 1 I+ p5 0:00.01 links
reed 6423 0.0 0.2 444 196 p5 I+ 10:59AM 0:00.00 sh -c l reed 6423 6290 6423
7a6600 1 I+ p5 0:00.00 sh -c links
I might be misunderstanding something, then why did Scott ask about it in
the first place? (I assume he doesn't use bash as /bin/sh.)
Right now I have 13 rxvt processes started by another 13 "sh -c" processes
all started by blackbox. I think these 13 "sh -c" processes are a waste of
time and resources. (Please note that my blackbox menu entries for these
rxvt's do not have any shell pipes, redirections or any other sh
functionality.)
Jeremy C. Reed
....................................................
BSD software, documentation, resources, news...
http://bsd.reedmedia.net/