From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3642d6516c1daa93eacc16850ae258e0@collyer.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] rc here docs From: Geoff Collyer In-Reply-To: <01d501c37034$9a184d00$b9844051@insultant.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Sun, 31 Aug 2003 20:19:04 -0700 Topicbox-Message-UUID: 26828fc0-eacc-11e9-9e20-41e7f4b1d025 I'm not suggesting { echo foo; echo bar; echo baz; echo quux } | cmd but rather echo 'foo bar baz quux' | cmd Given one echo command to replace one here document, I don't think the here documents are substantially cheaper than using echo. With echo, you have to load echo from disk (modulo caching) and it writes your message down a pipe. With a here document, the shell writes the here document into a temporary file, then attaches that temporary file as the command's standard input, so the command can read what the shell just wrote, then eventually the shell removes the temporary file; again this is all nominally disk i/o. (To make matters slightly worse, sh did unaligned writes of lengths not a multiple of 512 to the temporary files.) So here documents are not cheap and they do seem to clutter shells with considerable added complexity. I could probably live without them except that bundle uses them, sometimes to transmit large files that might even exceed Plan 9's ability to pass them as command-line arguments.