ShellQuote(3pm) | User Contributed Perl Documentation | ShellQuote(3pm) |
String::ShellQuote - quote strings for passing through the shell
$string = shell_quote @list; $string = shell_quote_best_effort @list; $string = shell_comment_quote $string;
This module contains some functions which are useful for quoting strings which are going to pass through the shell or a shell-like object.
If any string can't be safely quoted shell_quote will croak.
This routine might be changed to accept multiple string arguments in the future. I haven't done this yet because I'm not sure if the strings should be joined with blanks ($") or nothing ($,). Cast your vote today! Be sure to justify your answer.
$cmd = 'fuser 2>/dev/null ' . shell_quote @files; @pids = split ' ', `$cmd`; print CFG "# Configured by: ", shell_comment_quote($ENV{LOGNAME}), "\n";
Only Bourne shell quoting is supported. I'd like to add other shells (particularly cmd.exe), but I'm not familiar with them. It would be a big help if somebody supplied the details.
Roderick Schertler <roderick@argon.org>
perl(1).
2022-10-22 | perl v5.36.0 |