From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13797 invoked by alias); 2 Oct 2014 02:33:26 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 13760 invoked by uid 89); 2 Oct 2014 02:33:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 02 Oct 2014 02:33:09 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s922X8sN026019 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 1 Oct 2014 22:33:08 -0400 Received: from [10.3.113.55] (ovpn-113-55.phx2.redhat.com [10.3.113.55]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s922X7Jt009490 for ; Wed, 1 Oct 2014 22:33:08 -0400 Message-ID: <542CB963.4010004@redhat.com> Date: Thu, 02 Oct 2014 02:33:00 -0000 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: Re: Direct/efficient way to chop off trailing \n References: <1576090815.20141002032152@yandex.ru> <542CB798.8000800@cs.umass.edu> In-Reply-To: <542CB798.8000800@cs.umass.edu> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WORacJi2cBEIkP2Gu8VVktvW6FXj2S4LC" X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00021.txt.bz2 --WORacJi2cBEIkP2Gu8VVktvW6FXj2S4LC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 616 On 10/01/2014 08:25 PM, Eliot Moss wrote: > You could write my solution as: >=20 > echo -n `cygpath -aw foo`>/dev/clipboard 'echo -n' is not portable (in fact, you can disable it in bash, and it may misbehave if cygpath outputs a leading - or contains any \); it's better to use 'printf' for that purpose: printf %s `cygpath -aw foo`>/dev/clipboard > The echo solution has the good property that echo is > a shell built-in and so does not require spawning > another process. The same is true of printf. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --WORacJi2cBEIkP2Gu8VVktvW6FXj2S4LC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 539 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJULLljAAoJEKeha0olJ0NqoDYIAJnniSOmRE7cXWxWJS2dQqKz bZWwN1YBnnefQ47xHBI4fd6FLHtw9CcfqpyTKJ3QW4LQBi+Su76CdxRPYcO1pj+q 6dPquvhAXGrqUM+uWkr/w69D6VTHcKVzMTT7XZdzcvj586LLEIa1QctrTzVQTuE6 BuDmRDKnESbe1kZbH3T/DzKYJ1wmos5wNk0ITmJw/eTPA12UJYRDA7LJoGkx1DzM iTz5QesDZ74xf7MsGnHz4PZuUwhz8lQx+kj74NFIitbWMBiWpbWk/T8MiF2S+NJN B5oDhk6xxNSXtzgwqpsmzvnVL5Ir54naaWAYxszkHJdhzQWDGg68PEZeBXS9ppY= =/MqI -----END PGP SIGNATURE----- --WORacJi2cBEIkP2Gu8VVktvW6FXj2S4LC--