Die neue Computercommunity Compunnity! ist Online!
Hallo, die neue Community mit dem Thema Computer ist Online! Schau doch mal vorbei! Sonst Verpasst du vielleicht etwas! www.compunnity.de.tt! Wir freuen uns auf deinen Besuch! --- Bitte nicht auf diese Mail antworten! --- -- Powered by http://www.funpic.de Kostenloser Webspace with PHP und MySQL Support! 8x MySQL 8x FTP Traffic inklusive! Diese Email wurde vom Nutzer xdieb versendet. SPAM an [EMAIL PROTECTED] melden! -- 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/
How to uniformly point to the root of a drive?
Hi there, is there a way to consistently point (in a script for instance) to the root of a removable drive (flash drive)? The root could be /cygdrive/g on one computer and on the other /cygdrive/f (I have no control of the drive letters). One solution would be to install Cygwin to \ (instead of the standard \cygwin) but for clarity's sake I would like to keep the Cygwin stuff in a directory of its own. Any suggestions or hints? Thorsten -- 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 04:18:07PM +0100, Thorsten Kampe wrote: >Hi there, > >is there a way to consistently point (in a script for instance) to the >root of a removable drive (flash drive)? > >The root could be /cygdrive/g on one computer and on the other >/cygdrive/f (I have no control of the drive letters). One solution >would be to install Cygwin to \ (instead of the standard \cygwin) but >for clarity's sake I would like to keep the Cygwin stuff in a >directory of its own. > >Any suggestions or hints? Do you mean that you've got cygwin on a removable drive and want to figure out where it's running from? If so, then running a script from the drive and looking at $0 might work. If that doesn't give the full path then /proc/self/exe will but getting the symlink info might be tricky if you are in the setup phase of trying to figure out how to get to something like /bin/readlink.exe. 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/
Re: How to uniformly point to the root of a drive?
Thorsten Kampe wrote: > is there a way to consistently point (in a script for instance) to the > root of a removable drive (flash drive)? > > The root could be /cygdrive/g on one computer and on the other > /cygdrive/f (I have no control of the drive letters). One solution > would be to install Cygwin to \ (instead of the standard \cygwin) but > for clarity's sake I would like to keep the Cygwin stuff in a > directory of its own. I assume you mean the root directory of the drive on which Cygwin is installed, i.e. the drive containing /: echo "root dir of / is $(cygpath "$(cygpath -m / | cut -b1-3)")" This will fail for UNC paths and so on, but you can check for that I suppose. You can use any arbitrary path in place of /, but be sure to quote as necessary. Brian -- 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/
RE: How to uniformly point to the root of a drive?
On 20 May 2007 16:39, Brian Dessent wrote: > Thorsten Kampe wrote: > >> is there a way to consistently point (in a script for instance) to the >> root of a removable drive (flash drive)? >> >> The root could be /cygdrive/g on one computer and on the other >> /cygdrive/f (I have no control of the drive letters). One solution >> would be to install Cygwin to \ (instead of the standard \cygwin) but >> for clarity's sake I would like to keep the Cygwin stuff in a >> directory of its own. > > I assume you mean the root directory of the drive on which Cygwin is > installed, i.e. the drive containing /: > > echo "root dir of / is $(cygpath "$(cygpath -m / | cut -b1-3)")" > > This will fail for UNC paths and so on, but you can check for that I > suppose. You can use any arbitrary path in place of /, but be sure to > quote as necessary. This relies on the mountpoints being set correctly, which might not work if your drive letter changes ... cheers, DaveK -- Can't think of a witty .sigline today -- 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/
Re: How to uniformly point to the root of a drive?
Dave Korn wrote: > This relies on the mountpoints being set correctly, which might not work if > your drive letter changes ... Well if that is the case and / points to the wrong dir then I don't see how you can be using Cygwin at all, so many things will be broken. To get the POSIX path of the rootdir of the drive correponding to the CWD, then you can use something like: whatever="$(mount -p | tail -n1 | cut -f1 -d' ')$(cmd.exe /c "cd" \ | cut -b1 | tr 'A-Z' 'a-z')" But I don't see how this is useful in the least, since by definition if the mount table does not refelect reality then using POSIX paths for any purpose is unreliable at best and a waste of time at worst, so finding the POSIX path corresponding to the rootdir seems pointless. If you want to update the mount table you need the win32 path, not the POSIX path, and if the mount table has already been updated then this is much simpler. Brian -- 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/
RE: How to uniformly point to the root of a drive?
On 20 May 2007 17:11, Brian Dessent wrote: > Dave Korn wrote: > >> This relies on the mountpoints being set correctly, which might not work >> if your drive letter changes ... > > Well if that is the case and / points to the wrong dir then I don't see > how you can be using Cygwin at all, I'm not sure exactly what Thorsten is looking for in his original question, so I don't know if it's relevant here or not, but it might be useful for a portable installation to have a way to detect the drive letter so as to be able to (re)assign the mountpoints (e.g. from Cygwin.bat) before starting up a shell or other cygwin app. USB stick drive letters change very often... cheers, DaveK -- Can't think of a witty .sigline today -- 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/
Re: How to uniformly point to the root of a drive?
Dave Korn wrote: > I'm not sure exactly what Thorsten is looking for in his original question, > so I don't know if it's relevant here or not, but it might be useful for a > portable installation to have a way to detect the drive letter so as to be > able to (re)assign the mountpoints (e.g. from Cygwin.bat) before starting up a > shell or other cygwin app. USB stick drive letters change very often... Yes, there is a very real need for that kind of adjustment in such a situation, but you'd have to do it using native/batch scripting since trying to start a bash shell with /usr pointing off into empty space will probably not end well. Since the question seemed to be looking for the POSIX form of the rootdir I assumed that the mount tables had already been frobbed. Brian -- 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 08:39:13AM -0700, Brian Dessent wrote: >Thorsten Kampe wrote: >>is there a way to consistently point (in a script for instance) to the >>root of a removable drive (flash drive)? >> >>The root could be /cygdrive/g on one computer and on the other >>/cygdrive/f (I have no control of the drive letters). One solution >>would be to install Cygwin to \ (instead of the standard \cygwin) but >>for clarity's sake I would like to keep the Cygwin stuff in a directory >>of its own. > >I assume you mean the root directory of the drive on which Cygwin is >installed, i.e. the drive containing /: > >echo "root dir of / is $(cygpath "$(cygpath -m / | cut -b1-3)")" > >This will fail for UNC paths and so on, but you can check for that I >suppose. You can use any arbitrary path in place of /, but be sure to >quote as necessary. I wouldn't expect cygwin to be "installed" (as in a mount table existing) when running from a removable drive, though. In any event, if neither of the two described methods work then we'll probably need more clarification on what is being attempted here. 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 09:23:45AM -0700, Brian Dessent wrote: >Dave Korn wrote: >>I'm not sure exactly what Thorsten is looking for in his original >>question, so I don't know if it's relevant here or not, but it might be >>useful for a portable installation to have a way to detect the drive >>letter so as to be able to (re)assign the mountpoints (e.g. from >>Cygwin.bat) before starting up a shell or other cygwin app. USB stick >>drive letters change very often... > >Yes, there is a very real need for that kind of adjustment in such a >situation, but you'd have to do it using native/batch scripting since >trying to start a bash shell with /usr pointing off into empty space >will probably not end well. Since the question seemed to be looking >for the POSIX form of the rootdir I assumed that the mount tables had >already been frobbed. Except that he mentioned /cygdrive/? which doesn't require a root directory. I assumed that he was actually looking for a way to figure out where he was running from so that he could set up the mount table. 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/
RE: How to uniformly point to the root of a drive?
* Dave Korn (Sun, 20 May 2007 17:16:43 +0100) > On 20 May 2007 17:11, Brian Dessent wrote: > > Dave Korn wrote: > > > >> This relies on the mountpoints being set correctly, which might not work > >> if your drive letter changes ... > > > > Well if that is the case and / points to the wrong dir then I don't see > > how you can be using Cygwin at all, > > I'm not sure exactly what Thorsten is looking for in his original question, Something like "cat /cygdrive/g/autorun.inf" from a shell script. > so I don't know if it's relevant here or not, but it might be useful for a > portable installation to have a way to detect the drive letter so as to be > able to (re)assign the mountpoints (e.g. from Cygwin.bat) before starting up a > shell or other cygwin app. I already do that (something like "mount -fu %~d0\cygwin /") in a batch script. Unfortunately the %~d0" trick is a Cmd thing so I can't directly use it from bash or zsh. > USB stick drive letters change very often... That exactly is my problem... Thorsten -- 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/
Re: How to uniformly point to the root of a drive?
* Christopher Faylor (Sun, 20 May 2007 12:36:47 -0400) > On Sun, May 20, 2007 at 09:23:45AM -0700, Brian Dessent wrote: > >Dave Korn wrote: > >>I'm not sure exactly what Thorsten is looking for in his original > >>question, so I don't know if it's relevant here or not, but it might be > >>useful for a portable installation to have a way to detect the drive > >>letter so as to be able to (re)assign the mountpoints (e.g. from > >>Cygwin.bat) before starting up a shell or other cygwin app. USB stick > >>drive letters change very often... > > > >Yes, there is a very real need for that kind of adjustment in such a > >situation, but you'd have to do it using native/batch scripting since > >trying to start a bash shell with /usr pointing off into empty space > >will probably not end well. Since the question seemed to be looking > >for the POSIX form of the rootdir I assumed that the mount tables had > >already been frobbed. > > Except that he mentioned /cygdrive/? which doesn't require a root > directory. > > I assumed that he was actually looking for a way to figure out where he > was running from so that he could set up the mount table. The mount table is already set from a batch (4NT) script. I can refer to that quite easily with something like "set [EMAIL PROTECTED],% _cmdspec]" and then using %usb. -- 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 06:20:51PM +0100, Thorsten Kampe wrote: >* Dave Korn (Sun, 20 May 2007 17:16:43 +0100) >> On 20 May 2007 17:11, Brian Dessent wrote: >> > Dave Korn wrote: >> > >> >> This relies on the mountpoints being set correctly, which might not work >> >> if your drive letter changes ... >> > >> > Well if that is the case and / points to the wrong dir then I don't see >> > how you can be using Cygwin at all, >> >> I'm not sure exactly what Thorsten is looking for in his original question, > >Something like "cat /cygdrive/g/autorun.inf" from a shell script. > >> so I don't know if it's relevant here or not, but it might be useful for a >> portable installation to have a way to detect the drive letter so as to be >> able to (re)assign the mountpoints (e.g. from Cygwin.bat) before starting up >> a >> shell or other cygwin app. > >I already do that (something like "mount -fu %~d0\cygwin /") in a >batch script. Unfortunately the %~d0" trick is a Cmd thing so I can't >directly use it from bash or zsh. So it sounds like Brian's method would work then wouldn't it? 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >So it sounds like Brian's method would work then wouldn't it? Does this give you what you want, too? driveroot=$(cygpath $(cygpath -wm /)/..) 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/
Re: How to uniformly point to the root of a drive?
* Christopher Faylor (Sun, 20 May 2007 13:27:05 -0400) > On Sun, May 20, 2007 at 06:20:51PM +0100, Thorsten Kampe wrote: > >* Dave Korn (Sun, 20 May 2007 17:16:43 +0100) > >> On 20 May 2007 17:11, Brian Dessent wrote: > >> > Dave Korn wrote: > >> > > >> >> This relies on the mountpoints being set correctly, which might not > >> >> work > >> >> if your drive letter changes ... > >> > > >> > Well if that is the case and / points to the wrong dir then I don't see > >> > how you can be using Cygwin at all, > >> > >> I'm not sure exactly what Thorsten is looking for in his original > >> question, > > > >Something like "cat /cygdrive/g/autorun.inf" from a shell script. > > > >> so I don't know if it's relevant here or not, but it might be useful for a > >> portable installation to have a way to detect the drive letter so as to be > >> able to (re)assign the mountpoints (e.g. from Cygwin.bat) before starting > >> up a > >> shell or other cygwin app. > > > >I already do that (something like "mount -fu %~d0\cygwin /") in a > >batch script. Unfortunately the %~d0" trick is a Cmd thing so I can't > >directly use it from bash or zsh. > > So it sounds like Brian's method would work then wouldn't it? I suppose so. Something like [1] is even simpler and avoids running an external three times (which is quite expensive when runnning from a flash drive). Probably [1] could be even more concise. The "$usb[1]" to refer to the first character is zsh syntax. Thorsten [1] usb=$(cygpath -m /); usb=$usb[1] -- 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/
Re: How to uniformly point to the root of a drive?
* Christopher Faylor (Sun, 20 May 2007 13:36:16 -0400) > On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: > >So it sounds like Brian's method would work then wouldn't it? > > Does this give you what you want, too? > > driveroot=$(cygpath $(cygpath -wm /)/..) Yes. -- 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/
Re: How to uniformly point to the root of a drive?
Hi All... From: Christopher Faylor Subject: Re: How to uniformly point to the root of a drive? Date: Sun, 20 May 2007 13:36:16 -0400 On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >So it sounds like Brian's method would work then wouldn't it? Does this give you what you want, too? driveroot=$(cygpath $(cygpath -wm /)/..) What is the difference between "cygpath -m ..." and "cygpath -wm ..." Thanks, ...Karl _ Like the way Microsoft Office Outlook works? Youll love Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_outlook_0507 -- 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 05:39:21PM -0700, Karl M wrote: >Hi All... > >>From: Christopher Faylor Subject: Re: How to uniformly point to the root >>of a drive? >>Date: Sun, 20 May 2007 13:36:16 -0400 >> >>On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >>>So it sounds like Brian's method would work then wouldn't it? >> >>Does this give you what you want, too? >> >>driveroot=$(cygpath $(cygpath -wm /)/..) >> >What is the difference between "cygpath -m ..." and "cygpath -wm ..." Come on! Read the fine manual. 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/
Re: How to uniformly point to the root of a drive?
Hi Christopher... From: Christopher Faylor Subject: Re: How to uniformly point to the root of a drive? Date: Sun, 20 May 2007 21:21:59 -0400 On Sun, May 20, 2007 at 05:39:21PM -0700, Karl M wrote: >Hi All... > >>From: Christopher Faylor Subject: Re: How to uniformly point to the root >>of a drive? >>Date: Sun, 20 May 2007 13:36:16 -0400 >> >>On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >>>So it sounds like Brian's method would work then wouldn't it? >> >>Does this give you what you want, too? >> >>driveroot=$(cygpath $(cygpath -wm /)/..) >> >What is the difference between "cygpath -m ..." and "cygpath -wm ..." Come on! Read the fine manual. It is indeed a fine manual. I did look and -w and -m look to be mutually exclusive in thier use, but I did find scripts that use -wm, thus my question. Thanks, ...Karl _ PC Magazines 2007 editors choice for best Web mailaward-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507 -- 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/
Re: How to uniformly point to the root of a drive?
On Sun, May 20, 2007 at 09:12:47PM -0700, Karl M wrote: >Hi Christopher... > >>From: Christopher Faylor Subject: Re: How to uniformly point to the root >>of a drive? >>Date: Sun, 20 May 2007 21:21:59 -0400 >> >>On Sun, May 20, 2007 at 05:39:21PM -0700, Karl M wrote: >>>Hi All... >>> From: Christopher Faylor Subject: Re: How to uniformly point to the root of a drive? Date: Sun, 20 May 2007 13:36:16 -0400 On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >So it sounds like Brian's method would work then wouldn't it? Does this give you what you want, too? driveroot=$(cygpath $(cygpath -wm /)/..) >>>What is the difference between "cygpath -m ..." and "cygpath -wm ..." >> >>Come on! Read the fine manual. >> >It is indeed a fine manual. I did look and -w and -m look to be mutually >exclusive in thier use, but I did find scripts that use -wm, thus my >question. So, translation: cgf made a typo. The 'w' is not needed. 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/
Re: How to uniformly point to the root of a drive?
On 5/20/07, Karl M wrote: Hi All... >From: Christopher Faylor Subject: Re: How to uniformly point to the root of >a drive? >Date: Sun, 20 May 2007 13:36:16 -0400 > >On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: > >So it sounds like Brian's method would work then wouldn't it? > >Does this give you what you want, too? > >driveroot=$(cygpath $(cygpath -wm /)/..) > What is the difference between "cygpath -m ..." and "cygpath -wm ..." That's easy: they're exactly the same. Now for some tricky ones: 1)what does: "cygpath -lpw '/bin/nonexistant:/usr/bin'" do? 2)what's the difference between "cygpath -m ..." and "cygpath -t mixed ..."? 3)what's the difference between: "cygpath - -t mixed -t mixed -t unix -t mixed -mmm ..." and "cygpath -m ..." Answers follow: Answers 1) $ cygpath -lpw '/bin/nonexistant:/usr/bin' ÷;C:\cygwin\bin ^ That's a divided-by symbol there. Some lack of error checking somewhere, I suppose. 2) $ cygpath -t mixed .. && cygpath -t mixed -D C:/cygwin/home/ /cygdrive/c/Documents and Settings/Lev/Desktop $ cygpath -m .. && cygpath -m -D C:/cygwin/home/ C:/Documents and Settings/Lev/Desktop Ie, they're the same for usual paths, but '-t mixed' gives a unix path for the "system information" options 3) none -- 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/
Re: How to uniformly point to the root of a drive?
Hi Christopher... From: Christopher Faylor Subject: Re: How to uniformly point to the root of a drive? Date: Mon, 21 May 2007 00:15:42 -0400 On Sun, May 20, 2007 at 09:12:47PM -0700, Karl M wrote: >Hi Christopher... > >>From: Christopher Faylor Subject: Re: How to uniformly point to the root >>of a drive? >>Date: Sun, 20 May 2007 21:21:59 -0400 >> >>On Sun, May 20, 2007 at 05:39:21PM -0700, Karl M wrote: >>>Hi All... >>> From: Christopher Faylor Subject: Re: How to uniformly point to the root of a drive? Date: Sun, 20 May 2007 13:36:16 -0400 On Sun, May 20, 2007 at 01:27:05PM -0400, Christopher Faylor wrote: >So it sounds like Brian's method would work then wouldn't it? Does this give you what you want, too? driveroot=$(cygpath $(cygpath -wm /)/..) >>>What is the difference between "cygpath -m ..." and "cygpath -wm ..." >> >>Come on! Read the fine manual. >> >It is indeed a fine manual. I did look and -w and -m look to be mutually >exclusive in thier use, but I did find scripts that use -wm, thus my >question. So, translation: cgf made a typo. The 'w' is not needed. However, there are scripts (google "cygpath -wm") out there. :-) ...Karl _ More photos, more messages, more storageget 2GB with Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507 -- 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/