libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 6/6] use printf as $ECHO


From: Ralf Wildenhues
Subject: Re: [PATCH 6/6] use printf as $ECHO
Date: Mon, 10 Nov 2008 20:34:31 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

[ <http://thread.gmane.org/gmane.comp.gnu.libtool.patches/8788/focus=8811> ]

Hello Sven,

below is a question regarding your shell pages.

* Paolo Bonzini wrote on Mon, Nov 10, 2008 at 12:07:12PM CET:
> 
> > Esp., I'm quite sure that we need the cat here-document fallback;
> > [...] I am quite concerned that this patch will break
> > some of the older systems.

> There are two possible objections to the patch:
> 
> 1) portability.  I looked again at Sven Mascheck's pages, and you're
> probably thinking of http://www.in-ulm.de/~mascheck/various/uuoc/ where
> he says:
> 
>    Here documents [used with cat] force `as-is' output, if there are
>    character sequences which are special to echo(1), and if printf(1) is
>    not available".
> 
>    cat<<EOF
>    $VARIABLE
>    EOF

Actually, this is not what I remember the code to be.

> And this actually tells me: if we don't find an easy printf (either
> builtin or the first in the path) that works, there is no need to search
> *all* printf and *all* shells, we could use a shell function like
> 
>    func_fallback_echo()
>    {
>      cat <<_LTEOF
>    $1 (or $*)
>    _LTEOF
>    }

IIRC then it would have to be something like this:

func_fallback_echo()
{
  eval 'cat <<_LTEOF
$*
_LTEOF'
}

in order to prevent some shells from expanding $* already at function
definition time; but I don't remember for certain.  And IIRC I learned
this on your pages, Sven, but cannot find it any more now.

Can you enlighten us?  Was that eval unneeded after all?

Thanks!
Ralf




reply via email to

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