[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: |
Eric Blake |
Subject: |
Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function |
Date: |
Tue, 14 Jun 2011 08:26:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 |
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' "$*"
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/14
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function,
Eric Blake <=
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/14
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, James Youngman, 2011/06/14
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/15
- RE: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Voelker, Bernhard, 2011/06/16
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/16
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/17
- RE: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Voelker, Bernhard, 2011/06/20
- Re: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Jim Meyering, 2011/06/20
- RE: [PATCH] tests: use printf, not echo in init.sh's warn_ function, Voelker, Bernhard, 2011/06/20