This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: cygcheck.out
Description: Binary data

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]