Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Shell Script to Run Terminal as Root and cd and Execute a Command

    I have just installed an OBDII automobile code reader to get diagnostic codes. It is a python program run from the command line as root.

    Since I only will use this occasionally I would like to make a shell script to add to the panel so I don't have to remember the path file name and command to start it.

    I know that I can open the terminal with this command:


    The other commands if I could pass them to the terminal would be:

    cd /tmp/obdpy/pyobd-0.9/

    Is there a way to do this?


  2. #2
    Make a launcher the executes this command:
    gnome-terminal -x "sudo python /tmp/obdpy/pyobd-0.9/"
    and see if it is what you are looking for.

    You can also configure sudo not to ask for your password.

  3. #3
    I get a "There was an error creating the child process" error.

    I see it actually opens the terminal twice.

  4. $spacer_open
  5. #4
    maybe try to make it execute only:

    sudo python /tmp/obdpy/pyobd-0.9/

  6. #5
    Nothing happens when I try that.

    I did put the first line directly into the application launcher and it only brings up one terminal with the error mentioned above. Also there is no command prompt on the terminal screen after I clear the error message.

    Is there a log file somewhere for the gnome terminal?

  7. #6
    hmm, sorry I'm not sure. my only other thought would be to launch gnome-terminal with sudo and then just launch the command after the -x:

    sudo gnome-terminal -x "python /tmp/obdpy/pyobd-0.9/"
    also make sure that is indeed the path to the file, the /tmp makes me worried.

    Good luck.

  8. #7

    That didn't work either. I also tried just sudo gnome-terminal to see if that would bring up the terminal and it didn't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts