On Thu, May 02, 2024 at 07:11:46PM -0700, David Christensen wrote: > Perhaps Perl and the module String::ShellQuote ? > > 2024-05-02 18:50:28 dpchrist@laalaa ~ > $ touch "name with spaces" > > 2024-05-02 18:50:45 dpchrist@laalaa ~ > $ touch "name with\nnewline"
You didn't create a name with a newline in it here. You created a name with a backslash in it. If you wanted a newline, you would have to use the $'...' quoting form (in bash). touch $'name with\nnewline' > 2024-05-02 19:06:01 dpchrist@laalaa ~ > $ perl -MString::ShellQuote -e 'print shell_quote(@ARGV), "\n"' name* > 'name with spaces' 'name with\nnewline' I still insist that this is a workaround that should *not* be used to try to cancel out quoting bugs in one's shell scripts. Just write the shell scripts correctly in the first place.