[net.unix] more on echo command

hom@houxm.UUCP (H.MORRIS) (04/12/85)

While on the topic of "echo", it is remarkably hard to have a background
process output just a bell character with no carriage return (to signal
that it is done, say, while I am in a vi session).  I had been using a
'C' routine for this purpose, and finally discovered that I could say:
	echo "^G\c"
only to find out it does not work with UCB 4.2.
	I use this in a package which is shipped to various machines
and would like to have one less thing requiring compilation.

dave@uwvax.UUCP (Dave Cohrs) (04/13/85)

>                                                     I had been using a
> 'C' routine for this purpose, and finally discovered that I could say:
> 	echo "^G\c"
> only to find out it does not work with UCB 4.2.

With the 4.2BSD csh, the command 'echo -n ^G' works just fine.  This is also
the behavior of the 4.2 /bin/echo.  The other version works on Sys[35] and
version 7 (I think, it's been a while).
-- 
dave cohrs
...!{allegra,harvard,ihnp4,seismo}!uwvax!dave
dave@wisc-limburger.arpa

    (bug?  what bug?  that's a feature!)

ed@mtxinu.UUCP (Ed Gould) (04/14/85)

>                           ... and finally discovered that I could say:
> 	echo "^G\c"
> only to find out it does not work with UCB 4.2.

Sure enuf.  Years ago, in csh's infancy, some nameless author decided
that the syntax

	echo -n ...

was preferable.  Since echo was a builtin to csh, it was possible for
a time (under PDP-11 V7) to get the \c syntax from /bin/echo.  That
no longer works, either.  /bin/echo is now a duplicate if csh's
internal echo.

-- 
Ed Gould		    mt Xinu, 739 Allston Way, Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

long@ittvax.UUCP (H. Morrow Long [Systems Center]) (04/16/85)

> While on the topic of "echo", it is remarkably hard to have a background
> process output just a bell character with no carriage return (to signal
> that it is done, say, while I am in a vi session).  I had been using a
> 'C' routine for this purpose, and finally discovered that I could say:
> 	echo "^G\c"
> only to find out it does not work with UCB 4.2.

	For a good time read the story of echo in Kernighan and Pike's
	the Unix Programming Environment.  The following program will
	work under 4.2bsd.

#! /bin/sh
#
#	Ring bell continuously, frequency varies with load average.
#	To be really irritating to other users redirect the output 
#	to their terminals, i.e. 'annoy > /dev/ttyi4 &'.
#
while true
do
	echo -n "" 
done
-- 

				H. Morrow Long
				ITT-ATC Systems Center,
				1 Research Drive Shelton, CT  06484
				Phone #: (203)-929-7341 x. 634
	
path = {allegra bunker ctcgrafx dcdvaxb dcdwest ucbvax!decvax duke eosp1
	ittral lbl-csam milford mit-eddie psuvax1 purdue qubix qumix 
	research sii supai tmmnet twg uf-cgrl wxlvax yale}!ittvax!long

mac@tesla.UUCP (Michael Mc Namara) (04/19/85)

In article <171@uwvax.UUCP> dave@uwvax.UUCP (Dave Cohrs) writes:
>>                                                     I had been using a
>> 'C' routine for this purpose, and finally discovered that I could say:
>> 	echo "^G\c"
>> only to find out it does not work with UCB 4.2.
>
>With the 4.2BSD csh, the command 'echo -n ^G' works just fine.  This is also
>the behavior of the 4.2 /bin/echo.  The other version works on Sys[35] and
>version 7 (I think, it's been a while).
>-- 
>dave cohrs
>...!{allegra,harvard,ihnp4,seismo}!uwvax!dave
>dave@wisc-limburger.arpa
>
>    (bug?  what bug?  that's a feature!)

	We're beta testing a U**X 4.2/SYS5 on a Data General, and while
echo "kalshf\c" works in sh, the same thing in csh produces
% echo "kalshf\c"
kalshf\c
%
	Oh well, I guess that's why they've got us testing it; who else but
a net reader would care?				-mac@tesla.arpa

____________________________________________________________________________
On a clear disk you can see forever | 
----------------------------------------------------------------------------

smithrd@rtp47.UUCP (Randy D. Smith) (04/25/85)

>>> 	echo "^G\c"
>>> only to find out it does not work with UCB 4.2.
>>
>>With the 4.2BSD csh, the command 'echo -n ^G' works just fine...
>
>	We're beta testing a U**X 4.2/SYS5 on a Data General, and while
>echo "kalshf\c" works in sh, the same thing in csh produces...
>	Oh well, I guess that's why they've got us testing it; who else but
>a net reader would care?				-mac@tesla.arpa
>
>____________________________________________________________________________
>On a clear disk you can see forever | 
>----------------------------------------------------------------------------

`echo "^G\c"` behaves as expected when interpreted by the Bourne
shell, while `echo -n "^G"` behaves as expected when interpreted
by the csh.  "U**X 4.2/SYS5 on a Data General" (a.k.a. DG/UX) gives
you the best of both worlds, with both shells, each with the built-in
command "echo" behaving as expected.  To get Bourne shell behavior from
the csh, just use /bin/echo; to get csh behavior from the Bourne shell,
exec off a csh to handle the echo.

(By the way, the quote given in Knuth is "On a clear disk you can
seeK forever".  Makes a little more sense that way.)
   ^
[Please note that the preceding announcement reflects the viewpoint
of myself and myself alone.  My signature includes my employer's
name for information/identification purposes only.  This posting
should NOT be interpreted as a positional statement by any corporations
either living, dead, or otherwise ...]
-- 
					Randy D. Smith
			   Data General, Research Triangle Park, NC
			 {the known world}!mcnc!rti-sel!rtp47!smithrd