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:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=b3QG lWmqwlWsvv0UapSAdjgQsuool64FQ+cIFaqxG+Rb+8qky1WYjcOlO1c6+aLQ7huv SbvrHdrF30yM6GeMJx8OG0Y+scjAtPll/jf29vGnm4ohF9tp2DHRmpfzVLp6Fp1m nKXKcVyqhXDgw2JjYTjkdkotCN/Qd/a0D3qdChs= 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:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=E3/5LmDpAY mEkw6IEvR2aaS15HM=; b=bQ9V8iv3fXZ0qtJdu1frmsd28G0tnBU4TR8LXAd6Ys LCkpMm9edveIZQ3D2qNh7CX8DBeaou4kiH+OBKJJzaqhvewSOjt4nFtpBvkwvqjH 1BVUosQjmU24MDfWhXNIdpyIFKA5Syd3tTq1q163f1xBIQwSzFBPY9Mm/aunQcqQ s= 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=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail.spocom.com Date: Wed, 1 Oct 2014 15:08:08 -0700 From: Gary Johnson To: cygwin AT cygwin DOT com Subject: Re: Direct/efficient way to chop off trailing \n Message-ID: <20141001220807.GC10508@phoenix> Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes On 2014-10-01, Paul.Domaskis wrote: > Running bash in a Windows environment, I often find the need to > generate a full Windows path to a file so that I can access the file > from a Windows app. > > If I use > > cygpath -aw TheFile > /dev/clipboard > > I can paste into the Windows file-opener without browsing. Also, I > don't need to mouse around to highlight the result of cygpath. > However, the clipboard always contains an invisible carriage return, > which I have to remove by pressing backspacing. This doesn't visibly > change anything, but it does remove the trailing \n which chokes up > Windows. > > Since I hate manually deleting stuff that I can't see, the most > efficient way around this seems to be: > > cygpath -aw | tr -d '\n' > /dev/clipboard > > This is starting to get longer and longer. It is comprising the whole > goal of getting a sequence of operations that is so brief that one > does not sigh at having to do it countless times. > > Is there a more succinct way to get a clean path for a file from the > bash shell into the Windows clipboard? Define a function in your ~/.bashrc. winclip() { cygpath -aw "$@" | tr -d '\n' > /dev/clipboard } Then just execute winclip TheFile Regards, Gary -- 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