On Mon, Apr 12, 2010 at 12:23:01PM -0500, richardvo...@gmail.com wrote: > On Sun, Apr 11, 2010 at 7:09 PM, Colin Watson <cjwat...@ubuntu.com> wrote: > > On Sat, Apr 10, 2010 at 10:10:15PM +0100, Carles Pina i Estany wrote: > >> +gettext_escape_double_quotes () > >> +{ > >> + echo -n $(gettext $@) | sed 's/\"/\\\"/' > >> +} > > > > This is underquoted, and in any case the 'echo -n' is redundant since > > gettext itself already writes to standard output and $() substitution > > strips trailing newlines. $@ requires special treatment, and that sed > > s/// command needs /g. With my suggestion, I'd recommend: > > > > gettext_quoted () { > > gettext "$@" | sed "s/'/'\\\\''/g" > > } > > I haven't tried it myself, but you just said the newline is stripped > by $() and then took out the $(), seems like the newline would be > present again.
In context, gettext_quoted would always be called from inside $(), so this isn't a problem. (In general I find that it's best to write shell functions such that they emit trailing newlines on their output, and let the caller strip it if necessary; this usually comes out quite naturally. Of course there are exceptions.) -- Colin Watson [cjwat...@ubuntu.com] _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel