delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/10/01/22:33:40

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=tgT5c4
LiHh/xAtTlewGOk23jzJFZ5xYkZmxMQel6irzCkABjtTIUP9cJ/OHpyO8znM0+4n
e5pMb/oKMsrNB5PPmb0B9UwElBQ6XVh7SY2o8C0FT8zJMYUkqCKtagS7o1hX41hn
90/mr/Q8w6lF08ADiwddr3yp40FqovFPqWxBI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=XO6LNdqZoxqG
X5lKB2qVttfYjqw=; b=nIx5pvtKKayl7EUC1J0S4tGLZ0cn8EznYIP57dXUUSzS
BgdbgmOHRodt2zqp/psZfm8H0MNjByB0MAHqRdjgcxY8zj62MfwciMTyL+X8ht3b
2av6PHvdB5avzaQJpdhJio3W5WxHnytRM39a4Wp4nNOV3+1gVCYSaECi/tIitBc=
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
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
Message-ID: <542CB963.4010004@redhat.com>
Date: Wed, 01 Oct 2014 20:33:07 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Direct/efficient way to chop off trailing \n
References: <loom DOT 20141001T235147-60 AT post DOT gmane DOT org> <loom DOT 20141002T011040-272 AT post DOT gmane DOT org> <1576090815 DOT 20141002032152 AT yandex DOT ru> <542CB798 DOT 8000800 AT cs DOT umass DOT edu>
In-Reply-To: <542CB798.8000800@cs.umass.edu>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes

--WORacJi2cBEIkP2Gu8VVktvW6FXj2S4LC
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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"

-----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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019