Results 1 to 2 of 2

Thread: Shell script on QProcess with QString input

  1. #1
    Join Date
    Nov 2014
    Qt products
    Unix/X11 Windows

    Default 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:

    Qt Code:
    1. void Mark::on_btnProcess_clicked()
    2. {
    4. QStringList str_input , str_command1, str_command2, str_command3;
    5. str_input = ui->inputtextEdit->text();
    6. str_command1 = ui->value1textEdit->text();
    7. str_command2 = ui->value2textEdit->text();
    8. str_command3 = ui->value3textEdit->text();
    10. proc= new QProcess();
    11. proc->start("echo , QStringList() << "input="<< QString(str_input)<<"parameter1="<<QString(str_command1)<<"parameter2="<<QString(str_command2)<<"parameter3="<<QString(str_command23)<<">>");
    12. proc->start("gedit", QStringList() << "/current_dir/");
    14. }
    To copy to clipboard, switch view to plain text mode 

    But its not working , any idea?

    Thanks for advance,


  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default 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 ">>" 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?


Similar Threads

  1. Replies: 4
    Last Post: 22nd April 2014, 15:34
  2. Accesing linux shell script from Qt
    By Ricardo_arg in forum Qt Programming
    Replies: 2
    Last Post: 17th February 2011, 12:49
  3. QProcess: how to run shell script with password?
    By cutie.monkey in forum Qt Programming
    Replies: 0
    Last Post: 23rd March 2010, 05:43
  4. Call script shell with Qt
    By zeeb100 in forum Qt Programming
    Replies: 6
    Last Post: 26th February 2009, 09:17
  5. How to use shell script files ?
    By npc in forum Newbie
    Replies: 3
    Last Post: 15th February 2007, 08:26

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.