Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

calling script files

bluehash
2009-07-19
2013-01-13
  • bluehash
    bluehash
    2009-07-19

    I just finished compiling/installing Simon from sources on Fedora 11. Pretty impressive, i must say. I can now open firefox, gmail etc.

    Is there anyway I could execute a script(.sh) file. Should I  "Program" with ./hellow.sh and point to the working directory?

    I even tried installing Simon on Win7 RC and it works!

     
    • Peter Grasch
      Peter Grasch
      2009-07-19

      Hi!

      Thanks for the kind words!

      You can of course execute scripts like any other programs.

      Your suggestions might work (depending on the implementation in QProcess) but  I would simply suggest defining the full path to "hellow.sh" as the executable. You can still set the working directory if that is needed for your script.

      Greetings,
      Peter

       
  • aravorn
    aravorn
    2010-03-30

    Same problem on my gentoo . Start of KDE program works but start of any scripts don't work.

    executablecommand.cpp:
    KProcess proc;
    ...
    proc.setWorkingDirectory(workingDirectory.path());
    proc.setProgram(realExecutable, realSplitCommand);
    proc.startDetached
    

    found a workaround for that and start my scripts with kcmshell4:

    kcmshell4 -u <user> -c /home/test.sh

    using this with simon-0.2. I have looked at the code on simon-0.3-alpha and there are no noticable changes on executablecommand.cpp. So i guess the same problem

    regards, aravorn

     
  • aravorn
    aravorn
    2010-03-30

    sorry, the command is kdesu not kcmshell4

     
  • Peter Grasch
    Peter Grasch
    2010-03-30

    So it doesn't work by providing the full path?

    I just checked and it works fine for me on Gentoo (but this is certainly not distribution specific).

    kdesu is in your path which suggests that you are trying to run your script by simply calling "test.sh". This won't work unless /home is in your path (if the path you stated above is really correct).

    Please set the executable field to the full path of the test.sh and try again.

    Greetings,
    Peter

     
  • aravorn
    aravorn
    2010-03-31

    I've tested a lot with scripts and nothing worked for me. full path, with or without "". Also an simple

    /bin/echo test > /tmp/simontest
    

    don't work. I got my scripts only running with the KDE programm 'kdesu'.
    Should scripts not being started with this the function KProcess::setShellCommand ? But when this is the reason why is it starting on your system, hhhmm.

     
  • Peter Grasch
    Peter Grasch
    2010-04-01

    Are you trying to direclty execute that shell prompt? This is not supported.

    You should write this in a script file, lets call it test.sh:
    #!/bin/bash
    echo test > /tmp/simontest

    Save this file as test.sh and make it executable:
    chmod +x test.sh

    Then set the simon command to execute:
    /full/path/to/test.sh

    This should work.

    We don't use setShellCommand() because if I remember correctly that displays a command prompt in windows.

    Greetings,
    Peter

     
  • aravorn
    aravorn
    2010-04-01

    It was only a test to execute it directly.
    But with your example I found the error. It was my fault. I forgot the ! in all my scripts. Interpreter #!/bin/bash
    Now I don't need my kdesu wrapper anymore.
    Thanks for your help

     
  • Peter Grasch
    Peter Grasch
    2010-04-01

    You're welcome!