This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Programatically finding value of "cygdrive" prefix
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/