home *** CD-ROM | disk | FTP | other *** search
- 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
- From: f67700241@violet.ccit.arizona.edu (Greg Franklin)
- Newsgroups: comp.os.msdos.misc
- Subject: Re: Echo command in batch files
- Message-ID: <1992Nov20.220337.1@violet.ccit.arizona.edu>
- Date: 21 Nov 92 05:03:37 GMT
- References: <1992Nov19.163626.1@violet.ccit.arizona.edu> <1992Nov20.020415.8774@organpipe.uug.arizona.edu>
- Distribution: world,local
- Organization: University of Arizona
- Lines: 53
- Nntp-Posting-Host: violet
- Nntp-Posting-User: f67700241
-
- In article <1992Nov20.020415.8774@organpipe.uug.arizona.edu>,
- sfm@manduca.neurobio.arizona.edu (Stephen Matheson) writes:
- > From article <1992Nov19.163626.1@violet.ccit.arizona.edu>,
- > by f67700241@violet.ccit.arizona.edu (Greg Franklin):
- >> In article <tim.12.722026318@tim.src.utah.edu>,
- >> tim@tim.src.utah.edu (Tim Ma) writes:
- >>> To "suppress" the CR/LF in the DOS echo command, try:
- >>>
- >>> echo hello>temp world >> temp
- >>>
- >>> Output should be:
- >>> hello world
- >>>
- >>> Seems to work with MSDOS 5.0.
- >>
- >> With DR DOS 6.0 too. The question is: What does this batch line do?
- >
- > echo hello -- sends 'hello' plus a carriage return to
- > the display
- >
- > >temp -- intercepts the output of 'echo hello' and
- > sends it instead to the file named temp
-
- Then TEMP should contain a CR right after hello...
-
- > world -- continuation of the 'echo' command I think,
- > now sending 'world' to the display
- >
- > >> temp -- intercepts the echoing of 'world' and sends
- > it instead to the file named temp, appending
- > to it rather than overwriting
-
- ...but it doesn't!
-
- Neat. I have NEVER seen > and >> on the same batch file line before.
- But I wonder if this behavior is a batch language bug.
-
- As I understand it, I thought COMMAND.COM scanned the command line
- left to right, and when reaching a > or >>, parsed the remainder as a
- filename and ignored what it couldn't understand.
- "echo a > temp b >> temp" is undefined, I think.
-
- BTW, I discovered that on DR DOS the simpler
- ECHO hello > temp world
- produces the same effect as the above: no >> needed. Weird....
- --
- Greg "Mockingbird" Franklin Interviewer: "Sir, how do you spell relief?"
- f67700241@ccit.arizona.edu Dan: "R-O-L-A-I-D-S-E."
-
- "[George Bush is] the most ruthless white man in the history of the planet."
- -- Richard Ben Cramer, author of _What It Takes_
- "The President scores much better than Bill Clinton."
- -- Dan, comparing Bush's record of marital infidelity to Clinton's
-