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


Jerome Fong wrote:

> $ cd $ttt
> bash: cd: /cygdrive/c/Program: No such file or directory

Yes, that's wrong.  But more importantly, it's not wrong just in the
POSIX/Win32 path sense, it's wrong in the sense that it can't cope with
any argument that contains whitespace.  Your script would also fail on a
Linux system that for example had a directory like "~/some files" -- and
in that case there is no 8.3 short filename hack to save you, so there
is no avoiding the need for proper quoting.  It's got nothing to do with
cygpath and everything to do with proper portable scripting practice.

> Is is possible to setup the variable to not require the double quotes?

Only if you neglect to support filenames and paths with spaces in them.

>    Since my other method doesn't require the double quotes, it would
> make the scripting much easier.  I wouldn't need to keep track of which
> variables I had to double quote.

Easier perhaps but still broken.

Brian

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