我有一个使用system命令运行的命令。 我可以记录传递给shell的内容吗?
P.S。我有问题qoutes =)
答案 0 :(得分:1)
您可以在将字符串发送到系统命令
之前简单地打印它command = "whoami" # store the command as string
puts command # print it before you execute it
system(command) # execute it in the shell
答案 1 :(得分:1)
你提到“引号有问题”。我猜你的意思是双引号?修改Vapire的解决方案:
command = %Q{echo "double quoted string"} # store the command as string
puts command # print it before you execute it
system(command) # execute it in the shell