How can I abbreviate /cygdrive/DRIVELETTER ?

Andrew DeFaria ADeFaria@Salira.com
Fri Jan 17 05:40:00 GMT 2003


svartsjel@gmx.net wrote:

> Hi everyone!
>
> As I often access different drives from within the bash I'm wondering 
> if there's a quicker way to get on, say, drive l (a network drive) 
> than entering 'cd /cygdrive/l'? I alias'd '/cygdrive/l' to 'l' which 
> works fine for cd, but not for commands like chmod, cp, mv etc. Among 
> others I'd like to use the automatic command line completion which 
> doesn't work for /cygdrive/... either.
> Any suggestions?

I've long since changed the cygdrive prefix to /dev. Seemed like a 
natural place to put it and it's fairly short. Never encountered a problem.

However for cd'ing to a common location I tend to use environment 
variables such as:

$ export src="//server/share/path/to/src/file"

Then do things like cd $src. Normally, important areas are set up in my 
startup scripts. The nice thing is that if you wanted to say "more" a 
file that works to, with file name completion as in:

$ more $src/a/sub<tab>

Changes to

$ more //server/share/path/to/src/file/a/subdirectory.

Oh, and I also tend to use UNC names instead of mounting drive letters. 
So even if one did

$ net use L: \\\\server\\share\\path\\to\\src\\file

I would still tend to use the UNC name of 
//server/share/path/to/src/file or $src. One reason for this is that one 
persons L: drive may be another server/share all together on another 
desktop machine. With UNC names there is no ambiguity.

Note that while file name completion doesn't work on just a /cydri<tab> 
it will work after /cygdrive. Similarly filename completion does not 
work on //server/sha<tab> but if you type //server/share/pa<tab> it will 
start working. IOW you need to get past the server and share portions 
fully before file name completion is operative.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list