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 To: cygwin AT cygwin DOT com From: zzapper Subject: Re: Spaces in Paths Date: Mon, 28 Mar 2005 22:24:55 +0100 Lines: 61 Message-ID: References: <42486E04 DOT 2080700 AT tlinx DOT org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet AT sea DOT gmane DOT org X-Gmane-NNTP-Posting-Host: 241.119-84-212.ippool.ndo.com X-Newsreader: Forte Free Agent 2.0/32.652 X-IsSubscribed: yes On Mon, 28 Mar 2005 12:50:12 -0800, wrote: >zzapper wrote: > >>Hi, >>Mysql has now moved under c:/program files/ >>My backup bash script will run correctly if I use the follwing syntax >>/cygdrive/c/program\ files/mysql/MySQL\ Server\ 4.1/bin/mysqldump.exe $params >>However it doesn't work if I try to load the above into a variable >>eg >>mysqldump='/cygdrive/c/program\ files/mysql/MySQL\ Server\ 4.1/bin/mysqldump.exe' >>I get "/cygdrive/c/program\: No such file or directory..." >>Is this just hard luck? >> >---- > Basically you need to put double quotes around the $mysqldump >usage: "$mysqldump". > >Here's an example function to detect argument parsing: >function sa () { > if (($#==0)); then return; fi > echo \"$1\" > shift > sub $* >} >--- first the args as they look when you manually type in the >backslashes -- note that the backslashes are removed. >/> sa /program\ files/mysql/MySQL\ Server\ 4.1/bin/mysqldump.exe >"/program files/mysql/MySQL Server 4.1/bin/mysqldump.exe" >Another way of getting same thing: >/> sa "/program files/mysql/MySQL Server 4.1/bin/mysqldump.exe" >"/program files/mysql/MySQL Server 4.1/bin/mysqldump.exe" > >But if you assign to a variable, it loses the quotes when expanded: > >/> foo="/program files/mysql/MySQL Server 4.1/bin/mysqldump.exe" >/> sa $foo >"/program" >"files/mysql/MySQL" >"Server" >"4.1/bin/mysqldump.exe" > >What you want is to put quotes around the variable name: > >/> sa "$foo" >"/program files/mysql/MySQL Server 4.1/bin/mysqldump.exe" > >It's a minor "gotcha" catching those of us who were raised w/o >spaces in file names that has bitten me more than once, as well. > >It should be a habit on linux, as well,as spaces can occur >there as well. > Linda I don't know why I haven't had this problem before, except I usually try to avoid installing into c:\program files\ or I cheat by copying the executable into a short path. Dare I timidly suggest that this should be in the Cygwin FAQ section "spaces in file names/paths" -- 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/