LS and spaces in path names (the xth)
Tue Jun 28 14:15:00 GMT 2005
-----BEGIN PGP SIGNED MESSAGE-----
According to Andreas Eibach on 6/28/2005 7:14 AM:
> -rw-r--r-- 1 0 Jun 28 14:46 CD0.dat
> -rw-r--r-- 1 24K Jun 28 14:46 CD 1 - Multimedia.dat
> -rw-r--r-- 1 2.9K Jun 28 14:46 CD 2 - Multimedia.dat
> ls -hog "CD**"
> But why?
> After the 'CD', what character is this in Cygwin?
> It seems, it's not a valid character at all!
HINT - ls -Q shows a quoted representation of filenames, including those
mystery characters that aren't spaces. But since Windows doesn't allow
tabs in filenames, and I doubt you are using a managed mount, it might
very well be a space. Another thing to remember is that * filename
expansion only works if the * is not quoted, so try:
ls -hog "CD "**
ls -hog "CD **"
> Needless to say that scripts containing
> for i in `ls *.dat*`; do ....
> will NOT work,
Because you are typing too much (and by the way, this issue of scripting
vs. filenames with whitespace is not unique to cygwin). The shorter
version below does what you want (since filename expansion occurs after
word splitting), and is faster to boot (one less process)!
for i in *.dat*; do
Life is short - so eat dessert first!
Eric Blake email@example.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin