PDA

View Full Version : QProcess: how to run shell script with password?



cutie.monkey
23rd March 2010, 05:43
Hi all,

I'm having problem in running shell script file with password parameter in linux. I can run the sh file without password parameter like this:



process->start("sh", QStringList() << "shellscript.sh");


This works fine. But this time, i want to run this command:



echo mypassword | sudo -S sh shellscript.sh


This works fine in terminal..

I have no idea on how to run this in QProcess..
Any response would be very much appreciated..

thanks..