🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1842

Re: How do you pipe after a here document

#1842
From: Paul Chamberlain
Date: Tue, 27 Nov 1990 17:15
28 lines
1301 bytes
peter@ficc.ferranti.com (Peter da Silva) writes:
[asks how to pipe a here document to a complicated command.]

Actually, the solution was given in one of the original answers,
but it was among several other solutions so it may have been missed.

	#! /bin/sh
	# If sh sees a pipe it knows the command is continued
	cat <<END |
	I,ve got
	a lovely
	bunch of coconuts
	END
	grep coconuts |
	while read foo bar baz
		do
	  case $baz in
	    coconuts) echo $foo $bar THEM;;
	    *) echo su root -c 'rm -f /etc';;
	  esac
	done

On my RT this prints

	bunch of THEM

Paul Chamberlain | I do NOT represent IBM.     tif@doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif
Technical Details
Message-ID: <4358@awdprime.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!awdprime!doorstop.austin.ibm.com!tif
References: <1990Nov8.201508.13222@cid.aes.doe.CA> <27620006@hp-lsd.COS.HP.COM> <1F37P47@xds13.ferranti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!awdprime!doorstop.austin.ibm.com!tif
From: tif@doorstop.austin.ibm.com (Paul Chamberlain)
Newsgroups: comp.unix.shell
Subject: Re: How do you pipe after a here document
Message-ID: <4358@awdprime.UUCP>
Date: 27 Nov 90 17:15:25 GMT
References: <1990Nov8.201508.13222@cid.aes.doe.CA> <27620006@hp-lsd.COS.HP.COM> <1F37P47@xds13.ferranti.com>
Sender: news@awdprime.UUCP
Reply-To: tif@doorstop.austin.ibm.com (Paul Chamberlain)
Organization: IBM AWD, Austin, TX
Lines: 28