home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5174 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.2 KB  |  33 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!cs.utexas.edu!natinst.com!news.dell.com!lupus.dell.com!mikepb
  3. From: mikepb@lupus.dell.com (Michael P. Brininstool)
  4. Subject: Re: wanted: tutorial about sh programming
  5. Message-ID: <1992Dec28.224149.12534@raid.dell.com>
  6. Sender: news@raid.dell.com (Net News Admin)
  7. Nntp-Posting-Host: lupus.dell.com
  8. Reply-To: mikepb@lupus.dell.com
  9. Organization: Dell UNIX Support
  10. References: <1992Dec23.161830.20091@Celestial.COM> <1992Dec23.191853.24899@nosc.mil>
  11. Date: Mon, 28 Dec 1992 22:41:49 GMT
  12. Lines: 19
  13.  
  14. In article <1992Dec23.191853.24899@nosc.mil>, mcdono@nosc.mil (Tim McDonough CSC Room 191 Phone 553 3102 ) writes:
  15. |> 
  16. |> I'd like the following line to produce the output below it.
  17. |> 
  18. |> echo "Hostname is " $system "   Host id is " $hostid
  19. |> 
  20. |> Hostname is foo     Host id is 78454
  21. |> Hostname is fooobar Host id is 89000
  22. |> 
  23. |> I tried removing the quotes to no avail, any ideas?
  24.  
  25. Try something like this:
  26.  
  27. echo "$system $hostid" | \
  28. awk '{printf("Hostname is %-8s Host id is %5s\n",$1,$2)}'
  29.  
  30. ----------------------------------------------------------------------------|
  31. | Michael P. Brininstool   DELL UNIX PRODUCT SUPPORT  mikepb@lupus.dell.com |
  32. |----------------------------------------------------------------------------
  33.