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

Griff Smith ggs at ulysses.homer.nj.att.com
Fri Aug 5 03:42:35 AEST 1988


In article <19256 at tut.cis.ohio-state.edu>, lvc at tut.cis.ohio-state.edu.UUCP 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?
> Thanks,
| 
| -- 
| Larry Cipriani, AT&T Network Systems and Ohio State University
| Domain: lvc at tut.cis.ohio-state.edu
| Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (strange but true)

This is an artifact of the BSD/Sys-V echo differences.  Ksh has an ugly
kludge in it that tries to guess which echo semantics are expected.
You are expecting System V, the Sun is BSD (sort of).  To get the
System V semantics, put an empty executable file in your private bin
(the one that is searched before the system bins) and call it "echo".
Don't worry, it won't get executed.  Ksh looks through the search list
on start-up and makes notes about where it finds "echo".
-- 
Griff Smith	AT&T (Bell Laboratories), Murray Hill
Phone:		1-201-582-7736
UUCP:		{allegra|ihnp4}!ulysses!ggs
Internet:	ggs at ulysses.att.com



More information about the Comp.unix.questions mailing list