Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Date: Tue, 16 Aug 2005 16:54:50 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Programatically finding value of "cygdrive" prefix Message-ID: <20050816205450.GA16323@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com References: <42FA4604 DOT 8000507 AT tlinx DOT org> <20050810183616 DOT GA5892 AT trixie DOT casa DOT cgf DOT cx> <1124222681 DOT 29974 DOT 37 DOT camel AT p450> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1124222681.29974.37.camel@p450> User-Agent: Mutt/1.5.8i In the spirit of this soon-to-be-week-old thread I think I've come up with the ultimate way to find the cygdrive prefix. It meets all of the requirements that have been set out so far: 1) It is more complicated than my original solution 2) It is much slower than my original solution 3) It is not guaranteed to provide 100% correct results 4) Hitting CTRL-C while running it will leave stray subst'ed drives around that you may not want (an added bonus). Here it is: #!/bin/bash for f in c d e f g h i j k l m n o p q r s t u v w x y z; do subst "$f": "$SYSTEMROOT" >/dev/null 2>&1 || continue cd "$f":; cd .. cygdrive=$(pwd) subst /d "$f": break done echo "$cygdrive" HTH. cgf -- 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/