coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function


From: Jim Meyering
Subject: Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function
Date: Tue, 14 Jun 2011 16:38:31 +0200

Eric Blake wrote:
> On 06/14/2011 08:14 AM, Jim Meyering wrote:
>> I have been using "warn/die"-style functions like these for a few years,
>> and they are all based on printf (not echo) for precisely the reasons
>> listed in the log below.  I'm surprised that I put an echo-based
>> implementation into the relatively modern "init.sh".
>>
>> Anyhow, this fixes it:
>
> Not quite.
>
>>
>> -warn_ () { echo "$@" 1>&$stderr_fileno_; }
>> +warn_ () { printf '%s\n' "$@" 1>&$stderr_fileno_; }
>
> "warn_ a b" now results in:
>
> a
> b
>
> instead of the desired
>
> a b
>
> You want: printf '%s\n' "$*"

Argh.  Thanks.  Fixed.



reply via email to

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