Date: Fri, 5 May 2006 18:32:03 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-hackers@FreeBSD.ORG, cokane@cokane.org Subject: Re: [PATCH] Fancy rc startup style RFC - v6 Message-ID: <200605051632.k45GW2a5082588@lurza.secnetix.de> In-Reply-To: <346a80220604202041o7d631f43rbde4c84b5f7b16b4@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
Sorry for replying to an old message, but nobody has
responded to this particular question, so I give it
a try ...
Coleman Kane <zombyfork@gmail.com> wrote:
>
> One unfortunate thing about /bin/sh: [from the sh(1) manpage]
>
> Only one of the -e and -n options may be specified.
>
> This means that we may not be able to use the -n to chain multiple echos on
> one line...
You can use the backslash sequence '\c' with echo -e, which
has the same effect as the -n option. See sh(1).
Another possibility is to use dd(1) to strip off the new-
line (dd(1) lives in /bin, so it's available during boot).
A shell function like this does it:
echo-en()
{
x="$*"
echo -e "$x" | dd bs=$((${#x}-1)) count=1 2>/dev/null
}
Although it's a bit less efficient because dd(1) is an
external binary, it's more flexible since it can be used
for all kinds of cutting and trimming (note that cut(1)
resides in /usr/bin).
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
"When your hammer is C++, everything begins to look like a thumb."
-- Steve Haflich, in comp.lang.c++
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605051632.k45GW2a5082588>
