0

I'm trying to launch bash script from javascript (plasmoid). I have in plasmoid's main.js this command:

plasmoid.runCommand("bash-script.sh");

When starting plasmoid from terminal by plasmoidviewer, I can see all the output that I expecting to see. But I want to redirect script's output to file. So I trying to do it like this:

plasmoid.runCommand("bash-script.sh > output.txt");

But output.txt does not appear. Where am I wrong?

4

2 回答 2

1

这似乎有效:

plasmoid.runCommand("bash",["-c","./contents/code/bash-script.sh >output.txt"]);
于 2013-10-06T07:01:42.837 回答
0

尝试这样做:

plasmoid.runCommand("bash -c 'bash-script.sh > output.txt'");

'>' 是 bash 的运算符,用于将输出重定向到文件,因为它应该传递给 bash。

于 2013-10-06T05:26:26.613 回答