delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/13/14:15:33

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: zzapper <david AT tvis DOT co DOT uk>
Subject: Re: cd to directory in paste buffer : shell function
Date: Fri, 13 Jan 2006 19:14:34 +0000
Lines: 46
Message-ID: <7kufs1hho0p040i0l9jud4u6l889bqd1oe@4ax.com>
References: <rfqfs1pkamechtg6btjim15bkrt2l6miq5 AT 4ax DOT com> <Pine DOT GSO DOT 4 DOT 63 DOT 0601131349010 DOT 27020 AT access1 DOT cims DOT nyu DOT edu> <20060113190240 DOT GA4791 AT trixie DOT casa DOT cgf DOT cx>
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

On Fri, 13 Jan 2006 14:02:40 -0500,  wrote:

>On Fri, Jan 13, 2006 at 01:51:11PM -0500, Igor Peshansky wrote:
>>On Fri, 13 Jan 2006, zzapper wrote:
>>
>>> Hi,
>>>
>>> I often want to cd to a (DOS) path that I've copied from some Windows
sh proof
>>>
>>> function cdp()
>>> {
>>> # cdp(aste)
>>> # description : Cd to path in paste buffer: convert from DOS if required
>>> # set -x
>>> getclip
>>> echo ''
>>> getclip|sed 's#\\#\/#g'|putclip
>>> cd $(getclip)
>>> }

>>
>>How about simply
>>
>>cd $(cygpath -f - < /dev/clipboard)
>>

>>
>>DIR="$(cygpath -f - < /dev/clipboard)"
>>[ -d "$DIR" ] && cd "$DIR"
>
>Or, even:
>
>cdclip() {
>    cd "$(cygpath -f - < /dev/clipboard)" 2>/dev/null || :
>}
Funny thing my little script which I've gradually developed for months  solved a problem that's
niggled me for years then I post it up here and see it variously improved in minutes.

Aren't Newsgroups wonderful (also found a solution to how to repair my VW Golf today (not in Cygwin)
elsewhere

-- 
zzapper
Success for Techies and Vim,Zsh tips
http://SuccessTheory.com/


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

- Raw text -


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