When are Windows Short Path Names required - jraynersqlzip (1/1)

Eric Blake ebb9@byu.net
Mon Oct 24 13:18:00 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to zzapper on 10/24/2005 6:56 AM:
Please convince your mailer to send text files with a text mime-type, not
application/octet-stream.  Reposting here for convenience:

#!/bin/bash
# jraynersqlzip
# description : backup Mysql using sja.exe
# date 21Mar05
# v1.0
dirbackup="c:/backup/farms/"
eval filedate=$(date.exe '+%d%b%y')
ls -l $dirbackup/jraynerscheduled.sql

sjaprog="/sqlyog/sja.exe"
sjaprog="c:/progra~1/SqlYog~2/sja.exe"
sjaprog="/cygdrive/c/Program\ Files/SQLyog\ Enterprise/sja.exe"
sjascript="c:/cygwin/usr/local/bin/sql/jrayner.xml"
"$sjaprog" "$sjascript"

ls -l $dirbackup/
cp $dirbackup/jraynerscheduled.sql $dirbackup/jrayner$filedate.sql
ls -l $dirbackup/jrayner$filedate.sql


Here's your problem.  foo="a\ b" puts 4 characters into $foo.  On the
other hand, foo=a\ b puts 3 characters into $foo.  Also, foo='a b' puts 3
characterse into $foo.  Until you have the correct contents in $sjaprog,
then invoking "$sjaprog" will fail.  If you really want 4 characters in
$foo, then you need an eval to reparse the expansion.  Learn how to
properly use shell quotes - it will save you loads of headaches.

$ echo 'echo hi' > ./a\ b
$ foo="./a\ b"
$ eval $foo
hi
$ foo="./a b"
$ "$foo"
hi

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
volunteer cygwin bash maintainer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDXN9O84KuGfSFAYARAvSwAJ9VgsC6fUihjopWAfxrhMNCCQorywCfWLgA
c3VTtJ7wFwRJp1v9rfja1xg=
=3L9s
-----END PGP SIGNATURE-----

--
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/



More information about the Cygwin mailing list