How can I start a Shell Script using QProcess?
The Shell Script has eight different commands in it, some with arguments others without.
I tried to start the Shell Script with (using Ubuntu 11.10):
QProcess *Prozess = new QProcess();
Prozess->setWorkingDirectory(MainDirectory);
Prozess->start("/bin/sh", QStringList() << "Shell.sh");
But this doesn’t work, that means nothing happens. How to make it work?
Code is fine. Problem is at run-time.
Either your program can’t run
/bin/shfor some reason (test if you can rungeditinstead?), or theMainDirectoryvariable has wrong directory path (debug it), or theShell.shdoes not exist in that directory (capitalization mistakes? What about “./Shell.sh”?), or you don’t have enough privileges to run or modify target directory/files (are they owned by you?).