From owner-freebsd-questions Mon Jun 26 15:13:14 2000 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 7759F37B6F9 for ; Mon, 26 Jun 2000 15:13:07 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.15 #1) id 136h5B-000HUj-00; Mon, 26 Jun 2000 23:10:21 +0100 Received: (from ben) by strontium.scientia.demon.co.uk (Exim 3.15 #1) id 136h5B-000Cfk-00; Mon, 26 Jun 2000 23:10:21 +0100 Date: Mon, 26 Jun 2000 23:10:21 +0100 From: Ben Smithurst To: Mark Ovens Cc: questions@freebsd.org Subject: Re: Question about echo(1) Message-ID: <20000626231021.H57917@strontium.scientia.demon.co.uk> References: <20000626222417.J232@parish> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="pO/lLFQm5EGc7Efl" Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20000626222417.J232@parish> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --pO/lLFQm5EGc7Efl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Mark Ovens wrote: > I found in a script ``echo -e .....''. The echo(1) manpage doesn't > list this as an option. builtin(1) lists echo as both external and > internal to both csh(1) and sh(1) but the sh(1) manpage doesn't > mention echo. >=20 > Under csh(1) ``echo -e'' prints ``-e'', but under sh(1): >=20 > parish# sh > # echo >=20 > # echo -e >=20 > # echo foobar > foobar > # echo -e foobar > foobar > # >=20 > So, what does ``-e'' do under sh(1)? It might be a bash thing. From "man bash": echo [-neE] [arg ...] Output the args, separated by spaces, followed by a newline. The return status is always 0. If -n is specified, the trailing newline is suppressed. If the -e option is given, interpretation of the fol- lowing backslash-escaped characters is enabled. The -E option disables the interpretation of these escape characters, even on systems where they are interpreted by default. echo does not interpret -- to mean the end of options. echo interprets the following escape sequences: \a alert (bell) \b backspace \c suppress trailing newline \e an escape character \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \nnn the character whose ASCII code is the octal value nnn (one to three digits) \xnnn the character whose ASCII code is the hex- adecimal value nnn (one to three digits) in bash, bash-2.03$ echo -e "\a" (I heard a beep at this point...) bash-2.03$ echo "\a" \a but in sh they both just print "\a". --=20 Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D --pO/lLFQm5EGc7Efl Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use MessageID: ETjK0WSUbD7h7fElBiNA4ikHc9V72n1R iQCVAwUBOVfUzSsPVtiZOS99AQGlWgQAo3gltUJXIxAoF6JaNXD8MssIxxNyw+eK a271F9a1V2trv1X2bZqORqTfXrxyVjchmZ8+j5X49GaS6020aGFFbQGPI8r5YECL IQlHiV78QJdnTlBLZ7g9vbd/b18ZOHFwjOn1IfR7S5JScAUCRpLC3EudK6MNPEc9 6eQXI2dEYMA= =xWha -----END PGP SIGNATURE----- --pO/lLFQm5EGc7Efl-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message