delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/10/01/19:11:23

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:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; q=dns; s=
default; b=GJvHMa831J8ML4zBp7ojpcPuwY3d1k0Rj2dWHQLg/T3GRenOmyTgS
z/jWOd1RS9HK+6hrifYMwOKgk6BfP7473sRvvZicSIWvTXfS0oCZUDOBqG6aiBc0
IBbPnFmGmusAsdzuzCWhzXUnb+LhZqdvMH9bsnx17bfctCtbx32ibw=
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:to:from:subject:date:message-id:references
:mime-version:content-type:content-transfer-encoding; s=default;
bh=POmua5sDDbj35n2eGSz0cRIJBeY=; b=WjRGTZs4So65PR5qk3+l/3qZDJKd
3pZRBQVXtImI0wO34Fh4DxfXMwSS4mqEVR2gSui8qRsKqGbfGcfNzFxmfi55/Klz
32oZSOLdaht1Cl9t32YQNJKeIudAcZY2MQ0edEEiEmjtuAz/94M3dosrPja22u68
p4QibxpjMuh1Kd4=
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.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin AT cygwin DOT com
From: "Paul.Domaskis" <Paul DOT Domaskis AT gmail DOT com>
Subject: Re: Direct/efficient way to chop off trailing \n
Date: Wed, 1 Oct 2014 23:10:50 +0000 (UTC)
Lines: 40
Message-ID: <loom.20141002T011040-272@post.gmane.org>
References: <loom DOT 20141001T235147-60 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

On 2014-10-01, Paul.Domaskis wrote:
> cygpath -aw foo | tr -d '\n' > /dev/clipboard

Gary Johnson wrote:
> Define a function in your ~/.bashrc.
> 
>     winclip()
>     {
>         cygpath -aw "$ <at> " | tr -d '\n' > /dev/clipboard
>     }
> 
> Then just execute
> 
>     winclip TheFile

Jim Garrison wrote:
> Sounds like cygpath needs a "-n" option which eliminates the
> trailing newline.

Eliot Moss wrote:
> echo -n $(cygpath -aw foo) > /dev/clipboard? 

Gary, I was hoping for a magic bullet code idiom so that I don't have
to haul around a growing .alias.bash file.  But I think your solution
might be the only one that significantly cuts down on the typing.

Jim, I think you're right.  cygpath could benefit a lot from a -n
switch to suppress the new line.  From google, however, it's actually
just li'l olde me that would benefit as no one else seems to have the
want for it.  So I can see why such a switch has never been developed.
It's probably only needed for cygwin users, as it is the *unixy crowd
that uses both Windows & *nix at the same time.

Eliot, your solution takes 2 characters less than mine.  If I want to
live without spaces aroud the "$(" and the ")".  Which I suppose I
could do, for 2 characters.....  I'm a bit enamoured of the linear
simplicity of my original pipeline, though.  Appreciate the other
perspective, though.

Thank you all.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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