I successfully executed commands and .bat files in command prompt using XUL by this code:
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
var shell = new FileUtils.File(env.get("COMSPEC"));
var args = ["/c", "cd C:/ffmpeg/bin & record.bat"];
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(shell);
process.runAsync(args, args.length);
But now I changed .bat files to .sh files to run for Ubuntu and need to run commands in terminal by using same code, so I need to change environment variable "COMSPEC" to something which works for terminal, I found that it is "TERM" but didn't work.
Is there any other environment variable or way to do this task?