home *** CD-ROM | disk | FTP | other *** search
- Path: 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
-
- 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
-