Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Eric Blake Newsgroups: gnu.bash.bug Subject: Re: Paste with null delimiter Date: Tue, 3 Nov 2015 13:32:47 -0700 Organization: Red Hat, Inc. Lines: 74 Approved: bug-bash@gnu.org Message-ID: References: <3a207f09-fc2b-4a2e-a6e5-1d33c7479849@googlegroups.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2Sop4kUWgea1H0q3rgAAEnBXOjvkdqeVV" X-Trace: usenet.stanford.edu 1446582780 10162 208.118.235.17 (3 Nov 2015 20:33:00 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Dennis Williamson , "Julio C. Neves" Envelope-to: bug-bash@gnu.org Openpgp: url=http://people.redhat.com/eblake/eblake.gpg X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11826 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2Sop4kUWgea1H0q3rgAAEnBXOjvkdqeVV Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/03/2015 01:09 PM, Dennis Williamson wrote: > On Nov 3, 2015 12:47 PM, "Julio C. Neves" wrote= : >> >> Thanks Dennis, >> I know that you are rigth, but "paste -d"" odd even" and "paste -d "" = odd > even" are not the same? The diference is only a space between the optio= n > and its parameter. They are indeed not the same. In long option form, you have: paste -d "" odd even =3D=3D paste --delimiters=3D"" odd even =3D=3D paste --delimiters=3D odd even =3D=3D paste --delimiters "" odd even while: paste -d"" odd even =3D=3D paste -d odd even =3D=3D paste --delimiters=3Dodd even =3D=3D paste --delimiters odd even Remember, the shell strips quotes before it hands arguments to paste. Thus, paste is receiving, as argv, ["paste", "-d", "", "odd", "even"] for the first group, and ["paste", "-d", "odd", "even"] for the second group. There is NO way for any program using getopt() or getopt_long() to know if the user spelled '-d""' vs. '"-d"' vs. '-d', or any other myriad of patterns where the quotes are stripped. The ONLY way to pass an empty string argument to a short option is to do it as a separate argument, because the quotes are already stripped by the time argv is formed. Thus, the space is essential. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2Sop4kUWgea1H0q3rgAAEnBXOjvkdqeVV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWORnvAAoJEKeha0olJ0Nq/DoIAKVPuODcaFqCppZTT4s82GsR Uw5morZMFs/vyUeeyVwXDisxZ87Iz5CJEr/Iv9rzfKNNdcmFQYIxPG2kLdQXxCKD fB755pGLBIsNyEtadcnUr/dnNPT1cSw2/WDsVctT/rDvOC6Ew0HjQSp9l1bJN9sL OsyxL4LyQcAoQsSHGItdGV/2JRNRFCCei+BUHy98bS0HUmptdLqFbsmDJvlKZpUd muOb/thZJ8kXRrjx+kcK9FNaFlbrKXu8zFGlG+iQzCbvtp4tMqU3YwndMtMLcY1/ DONLA/Cilf/cTpVA0qWHPip9ZNg0Zv+dgDNJK+qbBmKNLBYP0pAb1YMK0YghSkU= =tPYX -----END PGP SIGNATURE----- --2Sop4kUWgea1H0q3rgAAEnBXOjvkdqeVV--