delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/28/00:07:14

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
From: "Gary R. Van Sickle" <g DOT r DOT vansickle AT worldnet DOT att DOT net>
To: "Cygwin mailing list" <cygwin AT cygwin DOT com>
Subject: Useful Cygwinism: "Explorer Here"
Date: Thu, 27 Jun 2002 23:06:13 -0500
Message-ID: <NCBBIHCHBLCMLBLOBONKMEOGDAAA.g.r.vansickle@worldnet.att.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Thought I'd share a neat trick with my fellow Cygwinners that I find extremely
useful, but that's maybe not all that obvious to people, and I've never seen it
mentioned.

The Problem:
You're cd'ing around at the bash command prompt, and you come to a directory
that you want to do some complex file/directory manipulations on; say, delete
all files except three.  That'd be a cinch in Windows' Explorer, but would
require all kinds of typing at the bash prompt.  Who has that kind of time in
this workaday world?  Not this soldier!

The Solution:
A tiny little alias I like to call "Explorer Here".  Add this little gem to your
.bash_profile, and wipe that sweat from your brow my friend!:

# Easy "Explorer Here" command
x()
{
	if [ "${1}" = "" ];
	then
		XPATH=".";
	else
		XPATH="$(cygpath -w "${1}")";
	fi
	explorer $XPATH &
}

Now, at the command prompt all you have to do is type "x" and hit enter, and an
explorer box pops up in your current directory!  AND, if you want to you can
specify the path thus "x /posix/path/here"!  PLUS, it doesn't block, mainly
because I can't think of a reason you'd ever want it to.

But Can It Core A Apple?:
Ohhoho, can it core a apple!  I have used this constantly for many months and
it's never let me down yet.  In fact I use it far more often than "Bash Here".

So that's it.  Seems like this would make a good entry in the User Guide, maybe
under "Setting Up Cygwin/Customizing Bash", or maybe it would be good to create
a "Using Cygwin/Useful Cygwinisms" for cygwin-specific tips and tricks like
this.  David S-B, are you maintaining the User Guide too or just the FAQ?

--
Gary R. Van Sickle
Brewer.  Patriot.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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