From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Andrei Gherzan <andrei@gherzan.ro>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] Replace "echo -e" with "printf" to have the same behavior in dash or bash
Date: Thu, 20 Sep 2012 10:13:24 +0100 [thread overview]
Message-ID: <1901405.KksRQfqGgP@helios> (raw)
In-Reply-To: <1348130679-31552-1-git-send-email-andrei@gherzan.ro>
On Thursday 20 September 2012 11:44:39 Andrei Gherzan wrote:
> oe-core removed the prerequisite to have sh as bash. POSIX doesn't define
> any options and furthermore allows echo -e to be the default behavior.
> This means that in dash "echo -e" will actually print "-e" and interpret
> backslashes by default. We use instead "printf" builtin command with or
> without "\n" to simulate echo -e or echo -n.
I haven't looked over the whole patch, but I did notice a couple of issues -
printf does not behave exactly like echo in a couple of situations:
(a) if you supply no arguments printf will return an error whereas echo does
not, this will probably break situations where you have changed the script to
do 'printf > /some/file'. Since these statements are usually intended to create
or truncate the specified file, I wonder if we should just change these to do '>
/some/file' instead which works for dash and bash (and doesn't otherwise appear
to be a bashism).
(b) 'printf "\n"' will print just one newline, whereas echo -e "\n" prints
two. Not sure if this is significant but I think we would rather keep the
behaviour the same.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
next prev parent reply other threads:[~2012-09-20 9:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-20 8:44 [PATCH] Replace "echo -e" with "printf" to have the same behavior in dash or bash Andrei Gherzan
2012-09-20 9:13 ` Paul Eggleton [this message]
2012-09-20 9:17 ` Andrei Gherzan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1901405.KksRQfqGgP@helios \
--to=paul.eggleton@linux.intel.com \
--cc=andrei@gherzan.ro \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.