Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!jcricket!sjs From: sjs@jcricket.ctt.bellcore.com (Stan Switzer) Newsgroups: comp.unix.wizards Subject: Re: Echo (and how to deal with what you got) Message-ID: <12592@bellcore.bellcore.com> Date: 12 Dec 88 16:13:39 GMT References: <6557@june.cs.washington.edu> <960@etnibsd.UUCP> <2258@xyzzy.UUCP> <81086@sun.uucp> Sender: news@bellcore.bellcore.com Reply-To: sjs@ctt.bellcore.com (Stan Switzer) Organization: Bellcore Lines: 19 Regardless of whether you prefer "echo -n" or "echo \c" sometimes you have to write a shell script that will prompt users correctly regardless of how echo works. I have been using the following trick for a while now, and I figured other people might find it useful: #!/bin/sh P1= P2= if test "`echo -n a; echo b`" = "ab" then P1="-n" # BSD style else P2="\c" # Sys V style fi echo $P1 "A prompt string: "$P2 read RESPONSE Possibly I picked this trick up from Larry Wall's "rn" configure script. Stan Switzer sjs@ctt.bellcore.com