Why doesn't \c work in sh/ksh echo on Suns?

Dave Burton daveb at laidbak.UUCP
Fri Aug 5 14:20:33 AEST 1988


In article <19256 at tut.cis.ohio-state.edu> lvc at tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes:
|On the Sun 3/50's here at Ohio State University sh and ksh don't
|work correctly when echo is given a string that terminates with
|a \c.  The output from:
|
|	echo "Enter terminal type: \c"
|
|should be the line "Enter terminal type: " but not terminated with
|a new line (and with the "'s removed).  This works in every other
|sh and ksh echo I've used.  Anyone know what the problem is?

SunOS is a 4BSD derived OS, and on 4BSD echo with no newline is
	echo -n "string "
Sys3?, Sys5.x et.al. use
	echo "string \c"

echo is not a builtin on earlier versions of sh (like the one with 4BSD),
thus with sh, echo is /bin/echo ala 4BSD.

echo is a builtin on ksh. ksh tries to configure itself to the target
system at compile time. To maintain shell script compatability, the
makefile determines which kind of echo /bin/echo is, then alters the
compilation of ksh to that behaviour.
-- 
Dave Burton		| ``/* You are not expected to understand this. */''
ihnp4!laidbak!daveb	|
(312) 505-9100 x325	| Disclaimer: I channel only for myself.



More information about the Comp.unix.questions mailing list