public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Accessing folders elsewhere than C:\cygwin
@ 2011-02-09 14:46 Fergus
  2011-02-09 15:38 ` Greg Chicares
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Fergus @ 2011-02-09 14:46 UTC (permalink / raw)
  To: Cygwin ML; +Cc: Fergus

I have Cygwin mounted conventionally under Q:\cygwin.
I would like to access files under Q:\else.
But (for example) ls ../../.. only ever attains \cygwin (and lower).
I can use ls /cygdrive/q/else/ (and lower) but this means knowing the 
drive name (in this case Q:)
I don't much want to change mount points which are currently 
conventionally defined.
Is there a way I can get to Q:\else without knowing the drive name Q:?
Thank you.
Fergus


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-09 14:46 Accessing folders elsewhere than C:\cygwin Fergus
@ 2011-02-09 15:38 ` Greg Chicares
  2011-02-09 16:39   ` Corinna Vinschen
  2011-02-09 15:50 ` Jeremy Bopp
  2011-02-09 15:53 ` Andrew Schulman
  2 siblings, 1 reply; 11+ messages in thread
From: Greg Chicares @ 2011-02-09 15:38 UTC (permalink / raw)
  To: cygwin

On 2011-02-09 14:42Z, Fergus wrote:
> I have Cygwin mounted conventionally under Q:\cygwin.
> I would like to access files under Q:\else.
> But (for example) ls ../../.. only ever attains \cygwin (and lower).
> I can use ls /cygdrive/q/else/ (and lower) but this means knowing the 
> drive name (in this case Q:)
> I don't much want to change mount points which are currently 
> conventionally defined.
> Is there a way I can get to Q:\else without knowing the drive name Q:?

ls `cygpath -m /`/../else

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-09 14:46 Accessing folders elsewhere than C:\cygwin Fergus
  2011-02-09 15:38 ` Greg Chicares
@ 2011-02-09 15:50 ` Jeremy Bopp
  2011-02-09 15:53   ` Jeremy Bopp
  2011-02-09 15:53 ` Andrew Schulman
  2 siblings, 1 reply; 11+ messages in thread
From: Jeremy Bopp @ 2011-02-09 15:50 UTC (permalink / raw)
  To: cygwin

On 02/09/2011 08:42 AM, Fergus wrote:
> I have Cygwin mounted conventionally under Q:\cygwin.
> I would like to access files under Q:\else.
> But (for example) ls ../../.. only ever attains \cygwin (and lower).
> I can use ls /cygdrive/q/else/ (and lower) but this means knowing the
> drive name (in this case Q:)
> I don't much want to change mount points which are currently
> conventionally defined.
> Is there a way I can get to Q:\else without knowing the drive name Q:?

If creating a new mount in addition to your standard mounts is out of
the question (not sure if that's what you meant), you could add
something like the following to your .bashrc or .bash_profile file:

function else_path {
  cygpath -u $(cygpath -m /)/../else
}

Then you could refer to the path as follows:

ls $(else_path)
cd $(else_path)

Another option would be to create a temporary mount within one of your
startup files:

mount | grep -q 'on /mnt/else type' ||
  mount $(cygpath -m)/../else /mnt/else

Now you can access Q:\else as /mnt/else.  If you decide you would like
to make a more permanent mount but just for your user, you can read in
the Cygwin Users Guide for how to set that up in a file under
/etc/fstab.d/.  Of course, you can also make the mount available to all
users by adding it to /etc/fstab. :-)

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-09 14:46 Accessing folders elsewhere than C:\cygwin Fergus
  2011-02-09 15:38 ` Greg Chicares
  2011-02-09 15:50 ` Jeremy Bopp
@ 2011-02-09 15:53 ` Andrew Schulman
  2 siblings, 0 replies; 11+ messages in thread
From: Andrew Schulman @ 2011-02-09 15:53 UTC (permalink / raw)
  To: cygwin

> I have Cygwin mounted conventionally under Q:\cygwin.
> I would like to access files under Q:\else.
> But (for example) ls ../../.. only ever attains \cygwin (and lower).
> I can use ls /cygdrive/q/else/ (and lower) but this means knowing the 
> drive name (in this case Q:)

Well at some level you're going to have to know the drive name - either in
the path you specify, or in a mount point or a symlink.

> I don't much want to change mount points which are currently 
> conventionally defined.
> Is there a way I can get to Q:\else without knowing the drive name Q:?

You don't have to change any existing mount points, but you can add a new
one in /etc/fstab, e.g.

Q:/else  /else  some_fs  binary 0 0

Or create a symlink:

ln -s /cygdrive/Q/else /else


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-09 15:50 ` Jeremy Bopp
@ 2011-02-09 15:53   ` Jeremy Bopp
  0 siblings, 0 replies; 11+ messages in thread
From: Jeremy Bopp @ 2011-02-09 15:53 UTC (permalink / raw)
  To: cygwin

On 02/09/2011 09:50 AM, Jeremy Bopp wrote:
> mount | grep -q 'on /mnt/else type' ||
>   mount $(cygpath -m)/../else /mnt/else
                     ^^^
I lost a slash in the above code.  It should be as follows:

mount | grep -q 'on /mnt/else type' ||
  mount $(cygpath -m /)/../else /mnt/else

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-09 15:38 ` Greg Chicares
@ 2011-02-09 16:39   ` Corinna Vinschen
  2011-02-10 17:13     ` Buchbinder, Barry (NIH/NIAID) [E]
  0 siblings, 1 reply; 11+ messages in thread
From: Corinna Vinschen @ 2011-02-09 16:39 UTC (permalink / raw)
  To: cygwin

On Feb  9 15:37, Greg Chicares wrote:
> On 2011-02-09 14:42Z, Fergus wrote:
> > I have Cygwin mounted conventionally under Q:\cygwin.
> > I would like to access files under Q:\else.
> > But (for example) ls ../../.. only ever attains \cygwin (and lower).
> > I can use ls /cygdrive/q/else/ (and lower) but this means knowing the 
> > drive name (in this case Q:)
> > I don't much want to change mount points which are currently 
> > conventionally defined.
> > Is there a way I can get to Q:\else without knowing the drive name Q:?
> 
> ls `cygpath -m /`/../else

This might result in a DOS path warning, but you can create a variable
containing the parent dir of the Cygwin root as POSIX path without
triggering the DOS path warning:

  cygwin_parent=$(cygpath -ua $(cygpath -ma /)/..)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Accessing folders elsewhere than C:\cygwin
  2011-02-09 16:39   ` Corinna Vinschen
@ 2011-02-10 17:13     ` Buchbinder, Barry (NIH/NIAID) [E]
  2011-02-10 17:15       ` Eric Blake
  0 siblings, 1 reply; 11+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2011-02-10 17:13 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen wrote
>  cygwin_parent=$(cygpath -ua $(cygpath -ma /)/..)

Might the ability to identify cygwin's root be a good
thing to add to cygpath?  (Note: I'm not commenting on
Corinna's proposal per se - hers was just the latest
email in this thread.)

Under "System information", one could have an option

  -R, --root    output cygwin root directory

where

$ cygpath -Rw
C:\cygwin

$ cygpath -Ru
/cygdrive/c/cygwin

or, if the cygdrive prefix has been changed to a simple /,

$ cygpath -Ru
/c/cygwin

Just an idea.  Unfortunately, I cannot propose a patch.

Thanks for considering this.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-10 17:13     ` Buchbinder, Barry (NIH/NIAID) [E]
@ 2011-02-10 17:15       ` Eric Blake
  2011-02-10 20:23         ` RISINGP1
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Blake @ 2011-02-10 17:15 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

On 02/10/2011 10:13 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Might the ability to identify cygwin's root be a good
> thing to add to cygpath?

And what's so hard about 'cygpath -w /'?

> Under "System information", one could have an option
> 
>   -R, --root    output cygwin root directory
> 
> where
> 
> $ cygpath -Rw
> C:\cygwin

Trading / for -R doesn't justify the bloat and burning another short
option character, in my opinion.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-10 17:15       ` Eric Blake
@ 2011-02-10 20:23         ` RISINGP1
  2011-02-10 20:36           ` Christopher Faylor
  0 siblings, 1 reply; 11+ messages in thread
From: RISINGP1 @ 2011-02-10 20:23 UTC (permalink / raw)
  To: cygwin

Eric wrote on 02/10/2011 12:15:33 PM:

> On 02/10/2011 10:13 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> > Might the ability to identify cygwin's root be a good
> > thing to add to cygpath?
> 
> And what's so hard about 'cygpath -w /'?
> 
> > Under "System information", one could have an option
> > 
> >   -R, --root    output cygwin root directory
> > 
> > where
> > 
> > $ cygpath -Rw
> > C:\cygwin
> 
> Trading / for -R doesn't justify the bloat and burning another short
> option character, in my opinion.
> 
> -- 
> Eric Blake   eblake at redhat dot com    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
> 

If you need it ofetn enough, here is a simple script for displaying the 
cygwin root:

case $1 in
    -w)
        mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
        ;;
    -u)
        DRIVE=$(mount | grep " / " | cut -d":" -f1):
        echo $(mount | grep "^$DRIVE " | \
        cut -d" " -f3)$(mount | grep " / " | cut -d" " -f1) | \
        sed 's/'$DRIVE'//'
        ;;
    *)
        echo "Please specify -w (Windows) or -u (Unix)"
        ;;
esac

- Phil

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-10 20:23         ` RISINGP1
@ 2011-02-10 20:36           ` Christopher Faylor
  2011-02-10 21:16             ` RISINGP1
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Faylor @ 2011-02-10 20:36 UTC (permalink / raw)
  To: cygwin

On Thu, Feb 10, 2011 at 03:23:38PM -0500, RISINGP1@nationwide.com wrote:
>Eric wrote on 02/10/2011 12:15:33 PM:
>
>> On 02/10/2011 10:13 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>> > Might the ability to identify cygwin's root be a good
>> > thing to add to cygpath?
>> 
>> And what's so hard about 'cygpath -w /'?
>> 
>> > Under "System information", one could have an option
>> > 
>> >   -R, --root    output cygwin root directory
>> > 
>> > where
>> > 
>> > $ cygpath -Rw
>> > C:\cygwin
>> 
>> Trading / for -R doesn't justify the bloat and burning another short
>> option character, in my opinion.
>
>If you need it ofetn enough, here is a simple script for displaying the 
>cygwin root:
>
>case $1 in
>    -w)
>        mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
>        ;;
>    -u)
>        DRIVE=$(mount | grep " / " | cut -d":" -f1):
>        echo $(mount | grep "^$DRIVE " | \
>        cut -d" " -f3)$(mount | grep " / " | cut -d" " -f1) | \
>        sed 's/'$DRIVE'//'
>        ;;
>    *)
>        echo "Please specify -w (Windows) or -u (Unix)"
>        ;;
>esac

Why would we need a simple script to display the cygwin root when
"cygpath -w /" works fine?

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Accessing folders elsewhere than C:\cygwin
  2011-02-10 20:36           ` Christopher Faylor
@ 2011-02-10 21:16             ` RISINGP1
  0 siblings, 0 replies; 11+ messages in thread
From: RISINGP1 @ 2011-02-10 21:16 UTC (permalink / raw)
  To: cygwin

cygwin-owner wrote on 02/10/2011 03:35:53 PM:

> 
> On Thu, Feb 10, 2011 at 03:23:38PM -0500, RISINGP1 wrote:
> >Eric wrote on 02/10/2011 12:15:33 PM:
> >
> >> On 02/10/2011 10:13 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> >> > Might the ability to identify cygwin's root be a good
> >> > thing to add to cygpath?
> >> 
> >> And what's so hard about 'cygpath -w /'?
> >> 
> >> > Under "System information", one could have an option
> >> > 
> >> >   -R, --root    output cygwin root directory
> >> > 
> >> > where
> >> > 
> >> > $ cygpath -Rw
> >> > C:\cygwin
> >> 
> >> Trading / for -R doesn't justify the bloat and burning another short
> >> option character, in my opinion.
> >
> >If you need it ofetn enough, here is a simple script for displaying the 

> >cygwin root:
> >
> >case $1 in
> >    -w)
> >        mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
> >        ;;
> >    -u)
> >        DRIVE=$(mount | grep " / " | cut -d":" -f1):
> >        echo $(mount | grep "^$DRIVE " | \
> >        cut -d" " -f3)$(mount | grep " / " | cut -d" " -f1) | \
> >        sed 's/'$DRIVE'//'
> >        ;;
> >    *)
> >        echo "Please specify -w (Windows) or -u (Unix)"
> >        ;;
> >esac
> 
> Why would we need a simple script to display the cygwin root when
> "cygpath -w /" works fine?
> 
> cgf
> 

OK.  You are right (somehow I missed the "cygpath -w /" mention in the 
thread - oops).

Change

        -w)
               mount | grep " / " | cut -d" " -f1 | sed 's:/:\\:g'
               ;;

to

        -w)
               cygpath -w /
               ;;

But "cygpath -u /" will give "/" as an answer.  The script will give (for 
me) "/cygdrive/c/cygwin".

I was merely trying to offer an alternative to Barry's request for the 
"-R" option on cygpath.  Specifically, it answers this part of his 
request:

> $ cygpath -Ru
> /cygdrive/c/cygwin
> 
> or, if the cygdrive prefix has been changed to a simple /,
> 
> $ cygpath -Ru
> /c/cygwin

- Phil

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-02-10 21:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-09 14:46 Accessing folders elsewhere than C:\cygwin Fergus
2011-02-09 15:38 ` Greg Chicares
2011-02-09 16:39   ` Corinna Vinschen
2011-02-10 17:13     ` Buchbinder, Barry (NIH/NIAID) [E]
2011-02-10 17:15       ` Eric Blake
2011-02-10 20:23         ` RISINGP1
2011-02-10 20:36           ` Christopher Faylor
2011-02-10 21:16             ` RISINGP1
2011-02-09 15:50 ` Jeremy Bopp
2011-02-09 15:53   ` Jeremy Bopp
2011-02-09 15:53 ` Andrew Schulman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).