bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#279992: xgettext misparses Bash source using "eval_gettext" and


From: Alexandre Duret-Lutz
Subject: Re: Bug#279992: xgettext misparses Bash source using "eval_gettext" and the `'' character (fwd)
Date: Mon, 15 Nov 2004 14:11:30 +0100

On Mon, Nov 15, 2004 at 01:36:09PM +0100, Bruno Haible wrote:
> Alfredo <address@hidden> wrote:
> > from the Advanced Bash Scripting Guide:
> >
> >     error "`eval_gettext \"Can't cd to \$var.\"`"
> >
> > using xgettext to extract this string doesn't work
>
> Indeed. This is because the backquote removes one level of backslashes,
> therefore the inner command actually is
>
>         eval_gettext "Can't cd to $var."
>
> So it substitutes var into the string before passing it to eval_gettext;
> this won't work. The inner command has to read
>
>         eval_gettext "Can't cd to \$var."
>
> therefore the complete command is
>
>         error "`eval_gettext \"Can't cd to \\\$var.\"`"
>
> and now xgettext extracts it as expected.

Actually, because there is no portable way to use a double-quoted
string inside a double-quoted `...` command substitution, you should
better write

   x=`eval_gettext "Can't cd to \$var."`
   error "$x"

See the end of
  http://lists.gnu.org/archive/html/libtool/2004-07/msg00094.html
and the top of the 'Shell Substitutions' section of the Autoconf manual.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]