On Sat, 23 Aug 2008 10:16:36 -0400, Thomas Dickey <[EMAIL PROTECTED]> wrote:
> spaces won't go away, and since they're legal in filenames, one may as
> well handle them.

Well, it's completely possible to create a file name like:

This is my *favourite* photo from "Cats" \ by Bob & Jane / my wife ~ 2008 

What a fun handling this. :-)

Call me old fashioned, but I don't mind making things more
complicated than it should be. The space character is the
command argument separator, as well as / is the root directory
and * is "everything". Applications like xmms can even replace
the _ by a space when showing the filename of an mp3 file (given
that no ID3 tag is provided). So I avoid spaces generally, and
when I get files with spaces, I do convert the names automatically.

> A script like
>       #!/bin/sh
>       for x in "$@"
>       do
>               echo $x
>       done
> handles quoting nicely enough (for spaces, anyway).  ls will translate
> some non-printing characters to printable; the 'find' program is a better
> alternative if one must derive the list inside the program.

That's correct; find can provide file names including paths and can
furthermore explude directories from being in the list (-type f).

In your script, $x contains the filename with spaces and should
be passed as one value to the program called.

>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to