in reply to Escape special chars in a path

bash quoting is simple: put single quotes around the string after replacing every ' in the string with '"'"'

sub bashquote { "'" . shift =~ s/'/'"'"'/gr . "'" }

Sure, sometimes the wrapping single quotes are not needed, but if they are just around directory names and file names, they don't hurt.

Replies are listed 'Best First'.
Re^2: Escape special chars in a path
by afoken (Chancellor) on Aug 21, 2022 at 10:23 UTC

    Used as a base for a repair attempt for String::ShellQuote: Re: Problems with String::ShellQuote

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)