X-Spam-Check-By: sourceware.org Message-ID: <7ff9c2a10601131028q66185044qb68ba0700b36fb21@mail.gmail.com> Date: Fri, 13 Jan 2006 10:28:45 -0800 From: Svend Sorensen To: cygwin AT cygwin DOT com Subject: Re: cd to directory in paste buffer : shell function In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline References: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k0DISrEN016745 On 1/13/06, zzapper wrote: > I often want to cd to a (DOS) path that I've copied from some Windows App. > > The following function (put in one of your startup files .bashrc .profile etc) saves a few clicks > and is forward or backslash 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) > } The cygpath program will do the slash conversion for you: cdclipboard() { unixpath=`cygpath -f /dev/clipboard`; if [ -d "$unixpath" ]; then cd "$unixpath" fi } -- 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/