delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_YG,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4D5C13D1.8010105@redhat.com> |
Date: | Wed, 16 Feb 2011 11:13:37 -0700 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: echo $(cygcheck...) oddity |
References: | <4D5C127D DOT 40401 AT member DOT fsf DOT org> |
In-Reply-To: | <4D5C127D.40401@member.fsf.org> |
OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
--------------enigE76C8D99BB2C2CAAE2ECC0A6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 02/16/2011 11:07 AM, L Anderson wrote: > Could the following signal a possible string buffering problem? Nope. Rather, it's an indication that cygcheck is a native windows program... > However,when I do >=20 > echo $(cygcheck /bin/sh.exe) I get: > C:\WINDOWS\system32\GDI32.dlllll and as such, it outputs \r\n line endings. When echo is given only one argument, it outputs that argument literally, so the \r are immediately followed by newline, and you don't notice the difference. But when echo is given multiple arguments, as is the case when you don't use "" around $(), then each argument is separated by a space rather than a newline. And since word splitting ate the \n, that only leaves you with \r, which rewinds to the beginning of the line for each line printed. > which clearly is unexpected. Then your expectations are wrong. Get in the habit of properly quoting command substitution. --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigE76C8D99BB2C2CAAE2ECC0A6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNXBPRAAoJEKeha0olJ0NqzAwIALDF9rhaIkfg68CNjzxxDBa0 Bw5EOw6E1jM1m41zD44AHMx73gWTkNBN51I37iP9GWLUR92vX34NPBs5rPXdTa9A RDizvLzuT8FEXegJuWmoeZai+lbHNIwqBj6Os/hCCXY8s1fb752u2ceev2DuB50g zgGJeh5wJ2wkfY1LQGzuLCC5J3anYJ5ZQyd9KMZOtPbSQBIF1FieUlqvegw8o1Jy t1YPzflJkgx6A7u7vXl+7ikDSifC+yUZcbs54mKnynR/Kww+gjgXk40UIHdN7piV qi5HEy8b2DXefraO9joJV4tJ6LVQFzszIIdSah+t/DPA4bsK/lx3h6LKgQcDCww= =WtDD -----END PGP SIGNATURE----- --------------enigE76C8D99BB2C2CAAE2ECC0A6--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |