in reply to Re^3: perl one-liner doesn't autochomp input
in thread perl one-liner doesn't autochomp input

As having been bitten by the spaces-in-filenames issue (again) this weekend on Mac OS X, I would like to point out that scripts need to handle filenames with spaces correctly.

Don't require a space-delimited stream of filenames, or if you must, then properly handle all names by way of double-quoting and/or escaping.

Sure, you can put newlines in filenames on some filesystems, too, but it is *far* less prevalent. Spaces occur in user files (and system files) all the time, thanks to Win95 and MacOS guis which encourage human-descriptive filenames.

--
[ e d @ h a l l e y . c c ]

  • Comment on Re^4: perl one-liner doesn't autochomp input

Replies are listed 'Best First'.
Re^5: perl one-liner doesn't autochomp input
by sintadil (Pilgrim) on Sep 07, 2004 at 17:51 UTC

    As having been bitten by the spaces-in-filenames issue (again) this weekend on Mac OS X, I would like to point out that scripts need to handle filenames with spaces correctly.

    Or you Mac and Windows people need to stop getting creative with filenames. :)

    As an actual solution, you can try using xargs -0 in such situations on OS X. Get a copy of ppt's (Gr. That should link to PPT, not to some search results!) xargs if you're on a Windows machine.