Possible bug in SunOS System V echo?

Daniel R. Levy levy at cbnewsc.ATT.COM
Fri May 4 09:44:51 AEST 1990


In article <3851 at munnari.oz.au>, kre at cs.mu.oz.au (Robert Elz) writes:
> >     echo "This is a variable value: $myvar"
> As best as I can tell, there's no easy way to reliably print the value
> of an unknown variable using the Sys V echo.
> 
> Try
> 
> 	myvar='\n'
> before the 2nd of the above with the V7 (BSD) and Sys V echos.

True.  There IS a portable-but-ugly way to implement a non-interpreting echo
under sh (csh too?):

cat << !
This is a variable value: $myvar
!

In the example given, this would print

This is a variable value: \n

under both System V and BSD.
-- 
Daniel R. Levy                        >>> God: just say "yes" <<<
AT&T Bell Laboratories        UNIX(R) mail:  att!ttbcad!levy, att!cbnewsc!levy
1000 East Warrenville Rd.     Any opinions expressed in the message above are
Naperville, Illinois  60566   mine, and not necessarily AT&T's.



More information about the Comp.unix.wizards mailing list