On Thu, Sep 24, 2009 at 03:05:07PM -0700, Mathias Dahl wrote: > I did not find any generic way to quote/escape file names so I > hardcoded some chars I know exist in my file names and used sed:
printf %q "$filename" will either insert backslashes in front of all the shell metacharacters, or $'...' quote the whole thing, or take some other action which renders a string "safe". It's basically the opposite of eval.