BeanShell中exec中的变量扩展

时间:2014-07-01 17:55:41

标签: python exec

我的beanshell脚本如下所示,我在调用exec来执行python脚本

String param="parameter1";
Runtime r = Runtime.getRuntime();
Process p = r.exec("/usr/bin/python /path/script.py param");

在python脚本中,第一个参数是“param”而不是“parameter1”。问题是如何将param的值传递给python脚本。

1 个答案:

答案 0 :(得分:1)

你有这样的尝试吗?

String param="parameter1";
Runtime r = Runtime.getRuntime();
Process p = r.exec("/usr/bin/python /path/script.py " + param);
相关问题