From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11701 invoked by alias); 1 Oct 2014 22:08:32 -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 11569 invoked by uid 89); 1 Oct 2014 22:08:31 -0000 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 Received: from mail.spocom.com (HELO mail.spocom.com) (206.63.224.240) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Oct 2014 22:08:30 +0000 Received: from localhost (spkdsl-116-45.cet.com [206.63.116.45]) by mail.spocom.com with SMTP; Wed, 1 Oct 2014 15:08:09 -0700 Date: Wed, 01 Oct 2014 22:08:00 -0000 From: Gary Johnson To: cygwin@cygwin.com Subject: Re: Direct/efficient way to chop off trailing \n Message-ID: <20141001220807.GC10508@phoenix> Mail-Followup-To: cygwin@cygwin.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 X-SW-Source: 2014-10/txt/msg00013.txt.bz2 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