[net.unix] echo -n

espo@bpa.UUCP (Bob Esposito) (01/08/85)

	Can someone out there tell me what echo -n does since my UNIX 5.0
	version does not support this option.


	Thanks in advance,

	B. Esposito   (burdvax | sjuvax) bpa!espo

notes@ucf-cs.UUCP (01/10/85)

echo -n does not append a newline to the argument string when it
prints it, thus it may be used when outputting prompts in shell
programs, etc.
				Ben Goldfarb
				{duke,decvax,akgua}!ucf-cs!goldfarb

phaedrus@eneevax.UUCP (The Sophist) (01/10/85)

I believe that `echo -n string' does'nt add a newline character at the
end of the string that is echoed.

-- 
			Pravin Kumar

Don't bother me! I'm on an emergency third rail power trip.

ARPA:   phaedrus!eneevax@maryland
UUCP:   {seismo,allegra,brl-bmd}!umcp-cs!eneevax!phaedrus

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (01/10/85)

> 	Can someone out there tell me what echo -n does since my UNIX 5.0
> 	version does not support this option.

"echo -n args" is the 7th Edition UNIX way of obtaining the same
function that in UNIX System V looks like: "echo 'args\c'".  There
is no good reason for the System V "echo" not also supporting the
7th Edition -n option; our SVR2 Bourne shell has been modified to
do just that.  (By the way, "echo" has no business being a shell
built-in, but that's life.)

ambekar@fortune.UUCP (Vinay R. Ambekar) (01/10/85)

In article <241@bpa.UUCP> espo@bpa.UUCP (Bob Esposito) writes:
>
>	Can someone out there tell me what echo -n does since my UNIX 5.0
>	version does not support this option.

	Echo normally appends a newline at the end of the string. With the
	-n option this is supressed.
							Vinay

Bill Poser <POSER@SU-CSLI.ARPA> (01/11/85)

By default, echo puts a newline at the end of the string it prints.
The -n option leaves out the newline. This is useful, for example, in
prompts; e.g. to prompt for terminal type in a .login file do:

	echo -n "Terminal: "

and whatever the user types will appear on the same line as the prompt.

Bill Poser (poser@su-csli).
-------

ebh@hou4b.UUCP (Ed Horch) (01/11/85)

> [Bob Esposito]
>
>	Can someone out there tell me what echo -n does since my UNIX 5.0
>	version does not support this option.

Echo -n suppresses the newline at the end of the output.  In Sys5,
putting a "\c" at the end of the command does the same thing.

-Ed Horch

biswas@ccvaxa.UUCP (01/11/85)

echo -n does not add newlines to the output.

ado@elsie.UUCP (Arthur David Olson) (01/12/85)

> > 	Can someone out there tell me what echo -n does since my UNIX 5.0
> > 	version does not support this option.
> 
> "echo -n args" is the 7th Edition UNIX way of obtaining the same
> function that in UNIX System V looks like: "echo 'args\c'".

For portability fans:
	echo args | tr -d "\012"
--
UNIX is an AT&T Bell Laboratories trademark.
--
	..decvax!seismo!elsie!ado	(country code 1)(301) 496-5688
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks

henry@utzoo.UUCP (Henry Spencer) (01/15/85)

> ...  (By the way, "echo" has no business being a shell
> built-in, but that's life.)

Sigh, I agree in a way, but...  You pays your money and you takes your
choice.  Making "echo" a builtin makes such a striking difference in
speed that it transforms shell applications programming.  We did this
ourselves to our local Bourne shell, and many things that we would
have had to write in C before can now be done as shell scripts.  I
wish there was a cleaner way to get the same effect.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

porges@inmet.UUCP (01/16/85)

	The confusion about echo -n is that some System III and such-type
systems use something else to suppress the newline:

% echo "string\c"

	puts out "string" with no newline.
					-- Don Porges
					...harpo!inmet!porges
					...hplabs!sri-unix!cca!ima!inmet!porges
					...yale-comix!ima!inmet!porges