tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Redoing the code in /bin/sh to handle the issues in PR bin/48875



A bit late due to vacation:

> To me, a command substitution that runs in the background seems weird 
> and like something to avoid. Is there really a case where this is useful, 
> or would it be reasonable to include a suggestion that it's best to avoid 
> such a construct?
The case that led to the PR mentioned was a shell script forking a (shell) 
daemon process with the need to know that daemon's PID (to register the 
incarnation). So there was the fork-and-background chant followed by an 
"echo $!", and all that surrounded by something like daemon_pid=$(...).
If you want to know even more detail, it was dotcache 
(http://www.math.uni-bonn.de/people/ef/dotcache) and I worked around it 
by invoking the record-pid code inside the backgrounding code.
And to further complicate things, that code was written for Debian, so dash, 
and the whole thing here started just because I was investigating whether 
my problem was specific to dash or triggered on another ash as well.


Home | Main Index | Thread Index | Old Index