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: <5.2.0.9.2.20030123222211.02c0ac18@pop3.cris.com> X-Sender: rrschulz AT pop3 DOT cris DOT com Date: Thu, 23 Jan 2003 22:33:32 -0800 To: cygwin AT cygwin DOT com From: Randall R Schulz Subject: Re: cygpath question In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Robert, Here's what happened: At 22:07 2003-01-23, Robert Mark Bram wrote: >Howdy all! > >I am trying to write a little script that will allow me to "cd" to any >directory in Cygwin by pasting in the Windows path.. Here is a screen dump >of my work so far: > > $ function cdd () { > > cd "`cygpath --unix "$*"`" > > } "$*" vs. "$@" -- The former always produces exactly one string (even if there are no arguments to the shell procedure), if the shell procedure had more than one argument, a space is inserted between each in the resulting concatenated single argument. The latter form ("$@") produces as many strings as there were arguments to the shell procedure (including zero strings if there were no arguments to the shell procedure) and nothing is added to the contents of those arguments. > $ pwd > / > > $ cdd C:\My Music Here's what happens: cd "`cygpath --unix "C:My Music"`" I'm guessing your Cygwin root is the same as your C: drive root, so in this case you more or less incidentally get the result you want because your current directory was "/" (Cygwin) and "C:/" (Windows). > $ pwd > /cygdrive/c/My Music > > $ cdd C:\Rob\mcd3060\Tri32002\a2 > bash: cd: C:Robmcd3060Tri32002a2: No such file or directory In this case, the unquoted backslashes essentially just disappear, since in each case the character they precede is not special. > $ pwd > /cygdrive/c/My Music > > $ > >Why does the first use work but not the second? > >*puzzled* If you want to use native Windows directory names (including both the drive prefix and the backslashes), you're not going get around explicitly quoting those names every time. If you have forward slashes (you won't get them from Windows Explorer, though), then you'll only need to quote the argument when there are spaces or other shell special characters, which is often enough. >Any help would be appreciated! > >Rob Randall Schulz -- 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/