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: List-Subscribe: List-Archive: List-Post: List-Help: , 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" Subject: Re: Direct/efficient way to chop off trailing \n Date: Wed, 1 Oct 2014 23:10:50 +0000 (UTC) Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 "$ " | 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