简体   繁体   中英

Launching bash script from javascript issue

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?

这似乎可行:

plasmoid.runCommand("bash",["-c","./contents/code/bash-script.sh >output.txt"]);

Try to do it that way:

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

'>' is a bash's operator to redirect output to file, and because that it should be passed to bash.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM