🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #210

Re: Embedded data in shell scripts?

#210
From: Marc W. Mengel
Date: Fri, 14 Aug 1992 21:08
30 lines
1130 bytes
Submitted-by: mengel@dcdmwm.fnal.gov (Marc W. Mengel)

davidf@mks.com ("David J. Fiander") writes:
>This seems to be attempting to ensure that a script like this
>	foo=`sed 1q`
>	hi there
>	echo $foo
>	echo Done
>When fed to the shell on standard input will generate the output
>	hi there
>	Done

This only works well on tty-style devices, where reads return
on end-of line boundaries.  It is also why the shell has
here-documents, so you can say

	foo=`sed 1q <<EOF
	hi there
	EOF`
	echo $foo
	echo Done

to to the job right in a script, pipeline, etc.

-------
Marc Mengel
mengel@fnal.fnal.gov


Volume-Number: Volume 28, Number 98
Technical Details
Message-ID: <16h7d3INNlkd@ftp.UU.NET>
Path: arc1-ca.pugleaf.net!sparky!uunet!uunet!not-for-mail
References: <16h4n3INNk80@ftp.UU.NET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!uunet!not-for-mail
From: mengel@dcdmwm.fnal.gov (Marc W. Mengel)
Newsgroups: comp.std.unix
Subject: Re: Embedded data in shell scripts?
Date: 14 Aug 1992 14:08:51 -0700
Organization: UUNET Communications
Lines: 30
Sender: sef@ftp.UU.NET
Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
Message-ID: <16h7d3INNlkd@ftp.UU.NET>
References: <16h4n3INNk80@ftp.UU.NET>
NNTP-Posting-Host: ftp.uu.net
X-Submissions: std-unix@uunet.uu.net