delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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 <cygwin AT tlinx DOT org> |
User-Agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
MIME-Version: | 1.0 |
To: | "'Cygwin List'" <cygwin AT cygwin DOT com> |
CC: | zzapper <david AT tvis DOT co DOT uk> |
Subject: | Re: Spaces in Paths |
References: | <fuag41pmagputqngs9robi6f1tv2ckk1r6 AT 4ax DOT com> |
In-Reply-To: | <fuag41pmagputqngs9robi6f1tv2ckk1r6@4ax.com> |
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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |