From: Ævar Arnfjörð Bjarmason Date: Wed, 02 Jun 2010 08:53:39 GMT Subject: Re: [PATCH/RFC v3 2/7] gettext: Add a Gettext interface for shell scripts Message-ID: In-Reply-To: <4C05FAEF.2040205@viscovery.net> On Wed, Jun 2, 2010 at 06:32, Johannes Sixt wrote: > [When you resend the series in such a manner that you collect a Cc list > manually, please do *not* include me. I'm not interested in this series.] > > Am 6/2/2010 1:39, schrieb Ævar Arnfjörð Bjarmason: >> +    # Not everyone has echo -n >> +    case $(echo -n) in >> +        \-n)    Xn=   ; Xc='\c' ;; >> +        *)      Xn=-n ; Xc= >> +    esac > > Don't use 'echo'; use 'printf %s'. I didn't write this code (as the comment says) but I /thought/ that the whole point of it was to autodetect if echo -n worked, and if so use it because it'd be faster than printf "%s", otherwise use some evil foo\n\c hack. That hack doesn't work on bash ('\c' produces a space), maybe it doesn't work anywhere. Do you have a shell that doesn't support echo -n? What does it output there? I wouldn't be surprised if it did need to be changed to printf "%s". I'm just curious where it broke and how.