开发者

execute perl script as passed argument

开发者 https://www.devze.com 2023-01-28 02:58 出处:网络
Im trying to execute a perl script as a passed argument from the command line. I compiled a c file and named it \"Test\", so trying to pass an argument I try this

Im trying to execute a perl script as a passed argument from the command line. I compiled a c file and named it "Test", so trying to pass an argument I try this

>Test perl -e "print qq{A\n}x500"

which I want to mean, run Te开发者_JAVA技巧st file and pass 500 A's, but it seems to not be working


Why do you think it should work? It runs Test and passes 3 arguments to it - perl, -e, "print qq{A\n}\x500". In bash it would be:

Test `perl -a "print qq{A\n}x500"`

For windows, there is no simple way to get a programs output as a variable or pass it to another command directly.

See this post, it describes how set a commands output to a variable.


Try using a pipe, you were latterly passing perl -e "print qq{A\n}x500" to Test.

Example of using a pipe :

perl -e "print qq{A\n}x500" | Test
0

精彩评论

暂无评论...
验证码 换一张
取 消