Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2000 09:26:01 -0400
From:      Jim C <jconner@enterit.com>
To:        Mark Ovens <mark@ukug.uk.freebsd.org>, freebsd-questions@freebsd.org
Subject:   Re: Question about echo(1)
Message-ID:  <4.2.0.58.20000627091845.00a84ce8@mail.enterit.com>
In-Reply-To: <20000626222417.J232@parish>

next in thread | previous in thread | raw e-mail | index | archive | help
At 22.24 26.06.00 +0100, 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.
>
>Under csh(1) ``echo -e'' prints ``-e'', but under sh(1):
>
>       parish# sh
>       # echo
>
>       # echo -e
>
>       # echo foobar
>       foobar
>       # echo -e foobar
>       foobar
>       #
>
>So, what does ``-e'' do under sh(1)?

It only manipulates how echo interprets escpae sequences within the bourne 
[again] shells.  In Korn, this argument is entirely not needed.

ie:

#!/bin/sh
echo -e "enter a number: \n >>>"
echo "Enter a number: \n"
EOF

$ ./script.sh

 >enter a number
 >>>
 >enter a number: \n

---------

Where as for korn

#!/bin/ksh
echo "Enter a number: \n >>>"
EOF

$ ./script.ksh

 >enter a number
 >>>

Notice in the first example when I didn't use the -e arg that the line -- 
echo "enter a number: \n" spit out  "enter a number: \n". The -e simply 
means escape :)

- Jim

>--
>   If I buy a copy of WinDelete, and it doesn't delete Windows,
>   am I entitled to my money back?
>________________________________________________________________
>       FreeBSD - The Power To Serve http://www.freebsd.org
>       My Webpage http://ukug.uk.freebsd.org/~mark/
>mailto:mark@ukug.uk.freebsd.org             http://www.radan.com
>
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.2.0.58.20000627091845.00a84ce8>