Gentoo Archives: gentoo-user

From: lee <lee@××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: xterm menu
Date: Tue, 20 Dec 2016 03:58:52
Message-Id: 87bmw7xnpn.fsf@heimdali.yagibdah.de
In Reply to: [gentoo-user] Re: xterm menu by Ian Zimmerman
1 Ian Zimmerman <itz@×××××××.net> writes:
2
3 > On 2016-12-19 21:49, lee wrote:
4 >
5 >> > [5+0]~$ FOO='foo,bar,baz'
6 >> > [6+0]~$ printf '%s\n' `echo $FOO | tr ',' ' '`
7 >> > foo
8 >> > bar
9 >> > baz
10 >>
11 >> Nice, thanks!
12 >>
13 >> I never realised there's printf and always wondered why I needed man 3
14 >
15 > In fact you don't even need printf for this:
16
17 exactly
18
19 > [3+0]~$ echo 'foo,bar,baz' | tr ',' '\n'
20 > foo
21 > bar
22 > baz
23 >
24 >> Hm. Does anyone know when printf was written? The man page seems to be
25 >> wrong:
26 >>
27 >> [~] printf --version
28 >> bash: printf: --: invalid option
29 >> printf: usage: printf [-v var] format [arguments]
30 >
31 > That's because bash has a printf builtin. This works:
32
33 Oh, I didn't know that, either.
34
35 > [1+0]~$ /usr/bin/printf --version
36 > printf (GNU coreutils) 8.25
37 > Packaged by Gentoo (8.25 (p1.1))
38 > Copyright (C) 2016 Free Software Foundation, Inc.
39 > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
40 > This is free software: you are free to change and redistribute it.
41 > There is NO WARRANTY, to the extent permitted by law.
42 >
43 > Written by David MacKenzie.