This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Programatically finding value of "cygdrive" prefix




Brian Dessent wrote:

Ken Dibble wrote:



mount -m | grep "mount -u" | tail -1 | awk -F'"' '{ print $2 }'

as
echo 'mount -s -b --change-cygdrive-prefix "/thing with spaces"' | awk
-F'"' '{ print $2 }'
results in
/thing with spaces



The awk part seems fine, but I don't know about the "mount -u". That will only match if you have a user-mode cygdrive set. As you can see from my example, that doesn't include me (or anyone else that installs cygwin choosing "All users" in setup.exe.)

If you're going to use awk then you can simplify and not bother with
grep and tail, they're extraneous.

mount -m | awk -F '"' '/--change-cygdrive-prefix/ { print $2 }'

Brian


Well, maybe my installation is hosed then. I have installed for all users, but mount -m returns

mount -f -s -b "C:/cygwin/usr/X11R6/lib/X11/fonts" "/usr/X11R6/lib/X11/fonts"
mount -f -s -b "C:/cygwin/bin" "/usr/bin"
mount -f -s -b "C:/cygwin/lib" "/usr/lib"
mount -f -s -b "C:/cygwin" "/"
mount -u -b --change-cygdrive-prefix "/cygdrive"
mount -s -b --change-cygdrive-prefix "/"


so...

mount -m | awk -F '"' '/--change-cygdrive-prefix/ { print $2 }'

results in

/cygdrive
/


so, I can see that the grep is not needed, but since there is more than one output line, tail, head or the like
would be needed, no?


Ken


-- 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]