Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!jpl From: jpl@allegra.UUCP (John P. Linderman) Newsgroups: net.unix-wizards Subject: Re: help needed with echo -e, S aed512 Message-ID: <2851@allegra.UUCP> Date: Sat, 13-Oct-84 12:23:48 EDT Article-I.D.: allegra.2851 Posted: Sat Oct 13 12:23:48 1984 Date-Received: Sun, 14-Oct-84 07:07:21 EDT References: <385@uwmacc.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 30 You'd think a command that "echos its arguments" would be simple and unambiguous, but echo is an object lesson in the ability of reasonable people to differ about "the obvious". For example, just about everybody will probably agree that distinct arguments ought to be separated on output in some way (every echo I know separates them with a single blank) and that a newline ought to follow the final argument. But every implementation I know of has also recognized that it is useful to be able to suppress the final newline, so prompts can be echoed. PWB UNIX systems in the early 70's adopted the convention that if the last two characters of an argument were \c, then the newline (and any subsequent arguments) would be suppressed. Berkeley UNIX adopted a -n flag to suppress the newline. I confess to being an early corrupter of echo, modifying it to recognize all the C escapes like \t and \f and \033. I complained to the forces then maintaining USG UNIX, and a version that accepted these escapes was eventually released. I think the escapes are great, because they make my shell scripts much more readable. Other people differ, and don't make the escapes available. Berkeley echo is in this camp. Version 8 UNIX lets you take your pick. The -e option causes the C escapes to be processed, its absence echos the arguments without interpretation. Since S grew up near, if not under, Version 8, I presume the flag means interpret escape sequences in the arguments. The good news is that it is very easy to modify echo to process the escapes. The bad news is that there are at least three distinct and incompatible versions of echo in common use, and writing portable (and readable) shell scripts is dreadfully difficult as a result. John P. Linderman Department of Antiquities allegra!jpl