in reply to how to escape round parentheses in a system call
To convert a string to a shell literal, you can use String::ShellQuote's shell_quote. (If you're building a Windows command, see Win32::ShellQuote.)
use String::ShellQuote qw( shell_quote ); my $cmd = shell_quote( "prog", $_->{Sub_URL}, "(?i)Podcast", @args ); system( $cmd );
But why invoke a shell at all?
my @cmd = ( "prog", $_->{Sub_URL}, "(?i)Podcast", @args ); system( { $cmd[0] } @cmd );
(Ignore afoken's disparagement of shell_quote. He thinks the fact that unix and Windows are different is a defect of the module.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to escape round parentheses in a system call
by roho (Bishop) on Jun 12, 2023 at 05:12 UTC | |
by ikegami (Patriarch) on Jun 12, 2023 at 05:20 UTC |