Gentoo Archives: gentoo-dev

From: Ian Stakenvicius <axs@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: esethome
Date: Fri, 15 Jun 2012 13:36:23
Message-Id: 4FDB3A2A.6040506@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: esethome by Peter Stuge
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA256
3
4 On 15/06/12 09:27 AM, Peter Stuge wrote:
5 > Mike Frysinger wrote:
6 >>> + # lets see if the username already exists + if [[
7 >>> ! -n $(egetent passwd "${euser}") ]] ; then
8 >>
9 >> "! -n" -> "-z"
10 >
11 > Does the $() argument ever need to be double quoted, or do all
12 > versions of bash actually have the string argument optional even
13 > though that's not what the man page reads?
14 >
15 >
16 > //Peter
17
18
19 Ever? Yes, but only if what is being returned can contain spaces (and
20 this matters in the way that it's used). In the case of 'egetent
21 passwd', afaict no as it doesn't return anything with whitespace in it.
22
23 Examples -- this works:
24
25 $ bubba="test thing" ; if [ -n "$(echo $bubba)" ]; then echo OK; fi
26 OK
27
28 Example -- this fails:
29
30 $ bubba="test thing" ; if [ -n $(echo $bubba) ]; then echo OK; fi
31 bash: [: test: binary operator expected
32
33 -----BEGIN PGP SIGNATURE-----
34 Version: GnuPG v2.0.17 (GNU/Linux)
35
36 iF4EAREIAAYFAk/bOioACgkQ2ugaI38ACPAUegD+JPzG4oX25QcqXYSfp/c2IE5o
37 aydKUHZonedILskm5UoA/2bnn2PMFh5lm1rXh7H4/2d9MQaghAUlCmMv0/XORQtW
38 =7fD+
39 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-dev] RFC: esethome Fabian Groffen <grobian@g.o>
Re: [gentoo-dev] RFC: esethome Peter Stuge <peter@×××××.se>