1.5.20: Running background scripts, that use backtick assighments, from other sh scripts

Steven Slany sslany@gmail.com
Fri Sep 22 07:18:00 GMT 2006


When attempting to run a sh script in the background, which uses
backticks to assign variable values, from another sh script, the
background process dies very quickly and leaves the forked (backticed)
process in a defunct state.

Example:

file1.sh:
-----------------------------------------------
#!/usr/bin/bash

./file2.sh &

------------------------------------------------


file2.sh
------------------------------------------------
#!/usr/bin/bash

while [ 1 ]
do
     val=`echo $val`
     val=$((val + 1))
     echo $val
done
------------------------------------------------

After running ./file1.sh, the background process will die very quickly
as seen with 'echo $val' and leave the forked (backtick) process in
what appears to be in a defunct state. This will still appear as a
process, as seen with 'ps', even though it appears defunct ( check out
link /proc/<pid>/cwd or file /proc/<pid>/cmdline). This does not
happen if I remove the backtick assignment from file2.sh as well. I've
ran into this problem running perl scripts with sh wrappers and the
same holds true for running sh scipts with backticks in the
background.

I've searched high and low on the mail list archives for this problem
with no avail. I've also ran into this problem with cygwin1.dll
version 1.5.19-4. I've attached my cygcheck output as well.

Thank You,
->SS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 53005 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060922/e520c65c/attachment.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list