[PATCH] Fancy rc startup style RFC - v6
Oliver Fromme
olli at lurza.secnetix.de
Fri May 5 16:32:17 UTC 2006
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 at 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++
More information about the freebsd-hackers
mailing list