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: <42486E04.2080700@tlinx.org> Date: Mon, 28 Mar 2005 12:50:12 -0800 From: Linda W User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: "'Cygwin List'" CC: zzapper Subject: Re: Spaces in Paths References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 -- 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/