home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / misc / 6239 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  2.5 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!ncar!noao!arizona!arizona.edu!violet.ccit.arizona.edu!f67700241
  2. From: f67700241@violet.ccit.arizona.edu (Greg Franklin)
  3. Newsgroups: comp.os.msdos.misc
  4. Subject: Re: Echo command in batch files
  5. Message-ID: <1992Nov20.220337.1@violet.ccit.arizona.edu>
  6. Date: 21 Nov 92 05:03:37 GMT
  7. References: <1992Nov19.163626.1@violet.ccit.arizona.edu> <1992Nov20.020415.8774@organpipe.uug.arizona.edu>
  8. Distribution: world,local
  9. Organization: University of Arizona
  10. Lines: 53
  11. Nntp-Posting-Host: violet
  12. Nntp-Posting-User: f67700241
  13.  
  14. In article <1992Nov20.020415.8774@organpipe.uug.arizona.edu>,
  15.   sfm@manduca.neurobio.arizona.edu (Stephen Matheson) writes:
  16. > From article <1992Nov19.163626.1@violet.ccit.arizona.edu>,
  17. > by f67700241@violet.ccit.arizona.edu (Greg Franklin):
  18. >> In article <tim.12.722026318@tim.src.utah.edu>,
  19. >> tim@tim.src.utah.edu (Tim Ma) writes:
  20. >>> To "suppress" the CR/LF in the DOS echo command, try:
  21. >>> 
  22. >>> echo hello>temp world >> temp
  23. >>> 
  24. >>> Output should be:
  25. >>> hello world
  26. >>> 
  27. >>> Seems to work with MSDOS 5.0.
  28. >> 
  29. >> With DR DOS 6.0 too.  The question is: What does this batch line do?
  30. >     echo hello --     sends 'hello' plus a carriage return to
  31. >             the display
  32. >     >temp      --    intercepts the output of 'echo hello' and
  33. >             sends it instead to the file named temp
  34.  
  35. Then TEMP should contain a CR right after hello...
  36.  
  37. >     world      --    continuation of the 'echo' command I think,
  38. >             now sending 'world' to the display
  39. >     >> temp    --   intercepts the echoing of 'world' and sends
  40. >             it instead to the file named temp, appending
  41. >             to it rather than overwriting
  42.  
  43. ...but it doesn't!
  44.  
  45. Neat.  I have NEVER seen > and >> on the same batch file line before.
  46. But I wonder if this behavior is a batch language bug.
  47.  
  48. As I understand it, I thought COMMAND.COM scanned the command line
  49. left to right, and when reaching a > or >>, parsed the remainder as a
  50. filename and ignored what it couldn't understand.
  51. "echo a > temp b >> temp" is undefined, I think.
  52.  
  53. BTW, I discovered that on DR DOS the simpler 
  54.   ECHO hello > temp world
  55. produces the same effect as the above: no >> needed.  Weird....
  56. -- 
  57. Greg "Mockingbird" Franklin      Interviewer: "Sir, how do you spell relief?"
  58. f67700241@ccit.arizona.edu               Dan: "R-O-L-A-I-D-S-E."
  59.  
  60. "[George Bush is] the most ruthless white man in the history of the planet."
  61.     -- Richard Ben Cramer, author of _What It Takes_
  62. "The President scores much better than Bill Clinton."
  63.     -- Dan, comparing Bush's record of marital infidelity to Clinton's
  64.