home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / std / unix / 383 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  1.1 KB

  1. Path: sparky!uunet!uunet!not-for-mail
  2. From: mengel@dcdmwm.fnal.gov (Marc W. Mengel)
  3. Newsgroups: comp.std.unix
  4. Subject: Re: Embedded data in shell scripts?
  5. Date: 14 Aug 1992 14:08:51 -0700
  6. Organization: UUNET Communications
  7. Lines: 30
  8. Sender: sef@ftp.UU.NET
  9. Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
  10. Message-ID: <16h7d3INNlkd@ftp.UU.NET>
  11. References: <16h4n3INNk80@ftp.UU.NET>
  12. NNTP-Posting-Host: ftp.uu.net
  13. X-Submissions: std-unix@uunet.uu.net
  14.  
  15. Submitted-by: mengel@dcdmwm.fnal.gov (Marc W. Mengel)
  16.  
  17. davidf@mks.com ("David J. Fiander") writes:
  18. >This seems to be attempting to ensure that a script like this
  19. >    foo=`sed 1q`
  20. >    hi there
  21. >    echo $foo
  22. >    echo Done
  23. >When fed to the shell on standard input will generate the output
  24. >    hi there
  25. >    Done
  26.  
  27. This only works well on tty-style devices, where reads return
  28. on end-of line boundaries.  It is also why the shell has
  29. here-documents, so you can say
  30.  
  31.     foo=`sed 1q <<EOF
  32.     hi there
  33.     EOF`
  34.     echo $foo
  35.     echo Done
  36.  
  37. to to the job right in a script, pipeline, etc.
  38.  
  39. -------
  40. Marc Mengel
  41. mengel@fnal.fnal.gov
  42.  
  43.  
  44. Volume-Number: Volume 28, Number 98
  45.