The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 10-21-2008
Squeakygoose Squeakygoose is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 14
Confirmed. feeding the pipe some dummy text (with an implicit EOF) before removing it causes the script to exit correctly:

Code:
cleanup()
{
if [ ${compress:-N} = Y ]
then
        echo "fail" >> ${pipe_name}
        rm -f ${pipe_name}
fi
}
Presumably the issue is coming from the gzip command not returning an exit code to the script process before it disappears, keeping the script process open. Killing the pipe before it feeds the gzip process anything seems to leave the script process in limbo. Feeding the dummy text is an OK workaround but it leaves me with the .gz file after a failure.

Does anyone know how to send JUST the EOF to a pipe? I'm hoping that this will cause the background gzip process to exit cleanly without creating a .gz file.