From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SfWhK-00059C-Mp for garchives@archives.gentoo.org; Fri, 15 Jun 2012 13:36:23 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E20F221C045; Fri, 15 Jun 2012 13:36:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0044921C032 for ; Fri, 15 Jun 2012 13:35:24 +0000 (UTC) Received: from [192.168.1.145] (CPE002401f30b73-CM001cea3ddad8.cpe.net.cable.rogers.com [99.240.69.152]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: axs) by smtp.gentoo.org (Postfix) with ESMTPSA id 512381B4033 for ; Fri, 15 Jun 2012 13:35:24 +0000 (UTC) Message-ID: <4FDB3A2A.6040506@gentoo.org> Date: Fri, 15 Jun 2012 09:35:38 -0400 From: Ian Stakenvicius User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120511 Thunderbird/10.0.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] RFC: esethome References: <4FD8B910.3090606@gentoo.org> <201206131514.51074.vapier@gentoo.org> <4FD8EB8C.90701@gentoo.org> <201206131651.12444.vapier@gentoo.org> <20120615132759.9714.qmail@stuge.se> In-Reply-To: <20120615132759.9714.qmail@stuge.se> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Archives-Salt: fb45d368-8288-49f4-bdcd-de1892063846 X-Archives-Hash: 05fed0625327f852b7809e70227c70b9 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 15/06/12 09:27 AM, Peter Stuge wrote: > Mike Frysinger wrote: >>> + # lets see if the username already exists + if [[ >>> ! -n $(egetent passwd "${euser}") ]] ; then >> >> "! -n" -> "-z" > > Does the $() argument ever need to be double quoted, or do all > versions of bash actually have the string argument optional even > though that's not what the man page reads? > > > //Peter Ever? Yes, but only if what is being returned can contain spaces (and this matters in the way that it's used). In the case of 'egetent passwd', afaict no as it doesn't return anything with whitespace in it. Examples -- this works: $ bubba="test thing" ; if [ -n "$(echo $bubba)" ]; then echo OK; fi OK Example -- this fails: $ bubba="test thing" ; if [ -n $(echo $bubba) ]; then echo OK; fi bash: [: test: binary operator expected -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iF4EAREIAAYFAk/bOioACgkQ2ugaI38ACPAUegD+JPzG4oX25QcqXYSfp/c2IE5o aydKUHZonedILskm5UoA/2bnn2PMFh5lm1rXh7H4/2d9MQaghAUlCmMv0/XORQtW =7fD+ -----END PGP SIGNATURE-----