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

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!nwnexus!Celestial.COM!ray
  3. From: ray@Celestial.COM (Ray Jones)
  4. Subject: Re: wanted: tutorial about sh programming
  5. Organization: Celestial Software, Mercer Island, WA
  6. Date: Sat, 26 Dec 1992 21:03:09 GMT
  7. Message-ID: <1992Dec26.210309.11538@Celestial.COM>
  8. References: <1992Dec23.161830.20091@Celestial.COM> <1992Dec23.191853.24899@nosc.mil>
  9. Lines: 29
  10.  
  11. In <1992Dec23.191853.24899@nosc.mil> mcdono@nosc.mil (Tim McDonough CSC Room 191 Phone 553 3102 ) writes:
  12.  
  13.  
  14. >I'd like the following line to produce the output below it.
  15.  
  16. >echo "Hostname is " $system "   Host id is " $hostid
  17.  
  18. >Hostname is foo     Host id is 78454
  19. >Hostname is fooobar Host id is 89000
  20.  
  21. >I tried removing the quotes to no avail, any ideas?
  22. >mcdono@sunspot.nosc.mil
  23. Assuming $system and $hostid vars are set, 
  24.  
  25. echo "Hostname is $system    Host id is $hostid"
  26.  
  27. should do the trick.  Variables will be replace inside double quotes,
  28. however, not inside single quotes.  Therefore;
  29.  
  30. echo 'Hostname is $system    Host id is $hostid'
  31.  
  32. will produce,
  33.  
  34. Hostname is $system    Host id is $hostid
  35. -- 
  36. INTERNET:  ray@Celestial.COM   Ray A. Jones; Celestial Software
  37. UUCP:   ...!thebes!camco!ray   6641 East Mercer Way
  38.              uunet!camco!ray   Mercer Island, WA 98040; (206) 947-5591
  39. The probability of one or more spelling errors in this missive approaches
  40.