delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/28/16:26:21

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
To: cygwin AT cygwin DOT com
From: zzapper <david AT tvis DOT co DOT uk>
Subject: Re: Spaces in Paths
Date: Mon, 28 Mar 2005 22:24:55 +0100
Lines: 61
Message-ID: <i9tg41hej0cjnmkvidnk7l3ehn3rch970l@4ax.com>
References: <fuag41pmagputqngs9robi6f1tv2ckk1r6 AT 4ax DOT com> <42486E04 DOT 2080700 AT tlinx DOT org>
Mime-Version: 1.0
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019