This is the mail archive of the
mailing list for the Cygwin project.
Re: cd to directory in paste buffer : shell function
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:
>>> I often want to cd to a (DOS) path that I've copied from some Windows
>>> function cdp()
>>> # cdp(aste)
>>> # description : Cd to path in paste buffer: convert from DOS if required
>>> # set -x
>>> 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"
> 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)
Success for Techies and Vim,Zsh tips
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html