[英]How can I pass command-line arguments containing special characters to a process launched via Perl or Bash?
我需要启动curl进行测试。 我需要发送包含/和其他疯狂内容的XML。最快的方法是什么?
curl -k -d '<xs:element name="Login"/>' https://thewebsite.com/page.exe
没有运气。
在Perl中,使用system的列表形式:
system curl
=> qw(-k -d '<xs:element name="Login"/>' https://thewebsite.com/page.exe);
或者更好的方法是使用WWW :: Curl (另请参见libcurl文档 )。
使用'qw'引用此处答案之一中给出的参数是不正确的,qw会显式转义并在xs标记周围传递单引号,而在OP的示例中,它们不会
你可以用...
system('curl', '-k', '-d', '<xs:element name="Login"/>',
'https://thewebsite.com/page.exe');
这应该是你所追求的。 我会尝试使用该模块。
反斜杠转义它。
\"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.