Should I escape shell arguments in Perl?

后端 未结 5 1190
没有蜡笔的小新
没有蜡笔的小新 2020-12-31 08:00

When using system() calls in Perl, do you have to escape the shell args, or is that done automatically?

The arguments will be user input, so I want to make sure this

5条回答
  •  渐次进展
    2020-12-31 08:21

    The answers on your question were very useful. In the end I followed @runrig's advice but then used the core module open3() command so I could capture the output from STDERR as well as STDOUT.

    For sample code of open3() in use with @runrig's solution, see my related question and answer:
    Calling system commands from Perl

提交回复
热议问题