🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.misc
Article #2908

Re: Echo command in batch files

#2908
From: Stephen Matheson
Date: Tue, 17 Nov 1992 23:58
114 lines
4130 bytes
From article <tim.12.722026318@tim.src.utah.edu>,
by tim@tim.src.utah.edu (Tim Ma):

> 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.
> 
> Tim Ma

Another idea, similar to one proposed below in your summary, but
simpler, I think:

Send the output strings to your batch file via replaceable parameters
(e.g., replaceable parameters %1 and %2 set to become your strings,
then invoke batch program by BATCH %1 %2).

Within the batch program, include ECHO %1 %2.

For example,

	SET %1=Hello
	SET %2=world

would appear somewhere after obtaining the strings.  Say the batch
file is HELOWRLD.BAT.  Start it by typing or calling HELOWRLD %1 %2.
Then, in HELOWRLD, the line

	ECHO %1 %2

yields "Hello world"; similarly, ECHO %1, %2 yields "Hello, world",
etc.

I am using two environment variables here, but no concatenation or
temporary files.  Perhaps you will find this less "clumsy".


> 
> Original Message below:
> -----------------------------------------------------------------------------
> 
> In article <1992Nov16.204439.17539@oracle.us.oracle.com>
>skanga@us.oracle.com (Shiraz Kanga) writes:
>>From: skanga@us.oracle.com (Shiraz Kanga)
>>Subject: Re: Echo command in batch files
>>Date: Mon, 16 Nov 1992 20:44:39 GMT
>>
>>In article <1992Nov14.190918.9554@oracle.us.oracle.com>
>>skanga@us.oracle.com (Shiraz Kanga) writes:
>>>Hi folks
>>>
>>>Does anyone know how to prevent echo from issuing a CR/LF at the
>>>end of a line.
>>>
>>>Eg : If I create the following file called test.bat
>>>
>>>echo hello > temp
>>>echo world >> temp
>>>
>>>The result in temp is:
>>>hello 
>>>world
>>>
>>>I need the result to be:
>>>hello world
>>>
>>>And yes I know echo hello world will work but what I'm trying to do is
>>>concatenate two strings which are output by two different programs and
>>>get both onto one line.
>>>
>>>Please respond by mail and I'll summarize to the net if there's interest.
>>>
>>>thanks
>>>
>>>shiraz
>>>skanga@oracle.com
>>>-- 
>>>Shiraz Kanga (skanga@oracle.com) Tel: (415)506-5412 Fax: (415)506-7822
>>>Analyst -- Desktop Tools Group -- Worldwide Technical Support -- 3OP11
>>>Oracle Corporation 500 Oracle Pkwy, MS 659311, Redwood Shores CA 94065
>>>"I work for Oracle - I speak and type (over here at least) for myself"
>>
>>Well folks, as promised heres my summary (since there was little interest)
>>
>>Some people suggested using external echo commands (xecho, etc) which are
>>available for anonymous ftp from various sites. This is not useful for me
>>since I am not using echo only.
>>
>>Another person suggested trying an embedded backspace which might erase the
>>CR/LF characters in the file. I did try this before posting and could not get
>>it to work.
>>
>>The most useful suggestion was to concatenate the strings in the
>>dos environment
>>and then output the variable to a text file. I will try this
>>(albeit clumsy) method as soon as I have the time.
>>
>>Thanks for the replies
>>
>>Shiraz
>>-- 
>>Shiraz Kanga (skanga@oracle.com) Tel: (415)506-5412 Fax: (415)506-7822
>>Analyst -- Desktop Tools Group -- Worldwide Technical Support -- 3OP11
>>Oracle Corporation 500 Oracle Pkwy, MS 659311, Redwood Shores CA 94065
>>"I work for Oracle - I speak and type (over here at least) for myself"

--

Steve Matheson   Program in Neuroscience   University of Arizona
sfm@neurobio.arizona.edu
Technical Details
Message-ID: <1992Nov17.235800.12898@organpipe.uug.arizona.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
References: <tim.12.722026318@tim.src.utah.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
From: sfm@manduca.neurobio.arizona.edu (Stephen Matheson)
Newsgroups: comp.os.msdos.misc
Subject: Re: Echo command in batch files
Message-ID: <1992Nov17.235800.12898@organpipe.uug.arizona.edu>
Date: 17 Nov 92 23:58:00 GMT
References: <tim.12.722026318@tim.src.utah.edu>
Sender: news@organpipe.uug.arizona.edu
Organization: University of Arizona UNIX Users Group
Lines: 114