<div dir="ltr">The writer is:<div><div>#/bin/ksh</div><div>PIPE=/tmp/backup.pipe</div><div>[[ ! -a $PIPE ]] && mkfifo $PIPE</div><div># Start gzip processes</div><div>/opt/cronjobs/zip1 &</div><div>/opt/cronjobs/zip2 &</div>
<div><br></div><div># Process files needing compression</div><div>let 'fc=0'</div><div>ls /zonebackup/*tar | while read F; do</div><div> echo $F >$PIPE</div><div> let 'fc=fc+1'</div><div>done</div>
<div><br></div><div>echo "end of list" >$PIPE</div><div>echo "end of list" >$PIPE</div><div>exit 0</div></div><div><br></div><div>The readers are:</div><div><div>#/bin/ksh</div><div>PIPE=/tmp/backup.pipe<br>
</div><div>NAME=zip1</div><div>if [[ ! -a $PIPE ]]; then<br></div><div> logger -p local0.warning "$NAME can't find $PIPE -- exiting"</div><div> exit 1</div><div>fi</div><div><br></div><div>while (( 1 )); do</div>
<div> read F <$PIPE</div><div> if [[ "$F" = "end of list" ]]; then</div><div> break</div><div> else</div><div> echo "$NAME: $F"</div><div>
fi</div><div>done</div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 1, 2014 at 1:29 PM, Kevin McGregor <span dir="ltr"><<a href="mailto:kevin.a.mcgregor@gmail.com" target="_blank">kevin.a.mcgregor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I tried fiddling with IFS to no avail. I just changed it like this:<div>IFS='</div><div>'</div><div>
And now the readers show all kinds of gibberish! All lines have no whitespace, save for the newline at the end. I'm assuming it's at the end. </div>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 1, 2014 at 12:47 PM, Robert Keizer <span dir="ltr"><<a href="mailto:robert@keizer.ca" target="_blank">robert@keizer.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Have you tried setting IFS ( field sep )? Also you could enable raw mode with -r. </p>
<p dir="ltr">Can you share the script?</p>
<p dir="ltr">Are the same lines failing repeatedly?</p>
<p dir="ltr">Rob</p>
<div class="gmail_quote"><div><div>On 2014-03-01 11:55 AM, "Kevin McGregor" <<a href="mailto:kevin.a.mcgregor@gmail.com" target="_blank">kevin.a.mcgregor@gmail.com</a>> wrote:<br type="attribution">
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div dir="ltr">I have a main script which writes to a named pipe. Before it starts writing, it starts two other scripts which read from this pipe. The reading and writing is a list of file names, one per line. How do I ensure that each script reads one complete line from the pipe at a time (no more, no less)?<div>
<br></div><div>I have a test set up, and it usually works, but sometimes a reader will get a blank line or just a "/" (but not any other part of a line)!</div><div><br></div><div>Kevin</div></div>
<br></div></div>_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca" target="_blank">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca" target="_blank">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>