This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygpath -u doesn't seem to convert spaces properly


Thanks,

Jerome

Williams, Gerald S (Jerry) wrote:
Brian Dessent wrote:
$ cd $ttt
bash: cd: /cygdrive/c/Program: No such file or directory
Yes, that's wrong.  [...] It's got nothing to do with
cygpath and everything to do with proper portable scripting practice.

Quite true. When you're using bash or sh, you must *quote your arguments* if they could possibly contain spaces or other word separators. So learn to do it. Seriously, take a few minutes and try it:

$ mkdir "a b c"
$ ABC="a b c"
bash: cd: a: No such file or directory
$ cd "$ABC"
... etc.

If you don't want to have to quote variable expansions all
the time, use another shell. I know that zsh, at least,
doesn't require you to quote them. That being said, you
still should learn how to quote in a regular POSIX shell.
Portable shell scripts should really start with #!/bin/sh,
after all.

-gsw



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]