Shell script on QProcess with QString input
Dear all,
I have shell script like this :
input=input parameter1=value1 parameter2=value2 \
parameter3=value3 \
Expected result: Input from ui (input, value1textEdit, value2textEdit, value3textEdit) will added to script >> print it to current directory (.sh) >> view that file using gedit.
Here my progress:
Code:
void Mark::on_btnProcess_clicked()
{
QStringList str_input , str_command1, str_command2, str_command3;
str_input = ui->inputtextEdit->text();
str_command1 = ui->value1textEdit->text();
str_command2 = ui->value2textEdit->text();
str_command3 = ui->value3textEdit->text();
proc->start("echo , QStringList() << "input="<< QString(str_input)<<"parameter1="<<QString(str_command1)<<"parameter2="<<QString(str_command2)<<"parameter3="<<QString(str_command23)<<">> test.sh");
proc->start("gedit", QStringList() << "/current_dir/test.sh");
}
But its not working :(, any idea?
Thanks for advance,
Regard,
Re: Shell script on QProcess with QString input
Aside from your snippet missing a quote after "echo"?
Well, I doubt echo can deal with an argument ">> test.sh" the way you assume it would.
">> filename" on a shell is interpreted by the shell and takes the output of the program and appends it to "filename".
The program itself never sees that as part of its argument list.
What do you actually want to do?
Cheers,
_