Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20030514204829.84578.qmail@web40307.mail.yahoo.com> Date: Wed, 14 May 2003 13:48:29 -0700 (PDT) From: Doug Jenkinson Subject: Scriptable Mount Points To: cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hey everyone, since I and a few of my friends have set up mount points in Cygwin for some the directories that we commonly used, I whipped up a bunch of scripts to take care that automatically. First of all, you need to create a ".mount" file in your home directory. Trust me, its really easy, in fact I made it up. The syntax is... [Windows Path:POSIX path] but without the []'s and only one per line. Now, in the windows path, make sure to escape that colon after the drive letter and the slash after that. For example, use "c\:\\" instead of "c:\" Also, that POSIX path is the location in the file system that you want the windows directory mounted to. And, yes, there can be spaces in the Windows path. Here's my file... (Cygwin on Win95) D\:\\Download:/home/download D\:\\My Documents\\Class:/home/class Second, in order for the mounted directories to show up in ls, we need to create a dummy directory, and mount over it. Really easy. So, in your ~/.bash_profile file, add the following: setup_mount_point() { echo "$1 -> $2" if [ ! -d "$2" ] then mkdir -p "$2" fi mount -f -b -u "$1" "$2" } while IFS=: read windows posix do setup_mount_point "$windows" "$posix" done <~/.mount And lastly, in order to clean up that mess when we exit, add the following to your ~/.bash_logout file. cleanup_mount_directories() { umount -u "$1" if [ -d "$1" ] then rmdir "$1" fi } while IFS=: read windows posix do echo "Cleaning up $posix" cleanup_mount_directories $posix done <~/.mount And, restart your cygwin session, and this will all take place on log in and log out for interactive Bash sessions only. Keep in mind, that while Cygwin is running, there will be empty dummy directories created in your home directory. You can delete these before you logout if you want, but then they won't show up in an ls listing. I hope this is interesting for at least one other person, any comments or questions can be sent my way. Doug Jenkinson __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com -- 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/