Path: utzoo!utgpu!attcan!uunet!husc6!bbn!uwmcsd1!ig!agate!pasteur!ames!oliveb!sun!gorodish!guy From: guy@gorodish.Sun.COM (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Why doesn't \c work in sh/ksh echo on Suns? Keywords: sh,ksh Message-ID: <62845@sun.uucp> Date: 4 Aug 88 18:25:51 GMT References: <19256@tut.cis.ohio-state.edu> Sender: news@sun.uucp Lines: 28 > 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? I can't speak for "ksh"; however, you've presumably not used a Version 7 UNIX shell, because "\c" doesn't do that in the V7 shell - you have to say echo -n "Enter terminal type: " The SunOS shell, starting in Release 3.2, can be made to support either form of echo. It pretends that "echo" is a regular command, rather than a built-in, that would reside either in "/bin" or in "/usr/5bin"; if it would have found the one in "/bin", it gives V7-style behavior with "-n" but no backslash escapes, and if it would have found the one in "/usr/5bin", it gives S5-style behavior with no "-n" but with backslash escapes including "\c". (Thanks and a tip of the Hatlo hat to Dave Korn for this trick. I don't know whether your "ksh" has this or not, since I don't know which "ksh" you have.) You can have your script set $PATH (shell scripts should always do that anyway, so they don't get surprised by non-standard $PATHs); however, this means you'd get the S5-environment versions of other commands as well, which may or may not be what you want.