opening roxterm with command run multiple commands

lxle
2013-10-25
2013-10-29
  • lxle

    lxle - 2013-10-25

    I can open roxterm with a command and can run a command from the same string, however it will not continue on to run the next command.

    example

    roxterm --geometry 70x30 -T "window title" -e command; -e command2

    or

    roxterm --geometry 70x30 -T "window title" -e command && -e command2

    both do not work, the first command runs fine, but it never makes it to the second command, any help is appreciated.

    thanks

     
  • dodger

    dodger - 2013-10-26

    That's normal...
    Plz have a look at bash special chars:
    http://tldp.org/LDP/abs/html/special-chars.html
    and 'man roxterm' will solve "the rest" questions about launching commands.

     
  • Tony Houghton

    Tony Houghton - 2013-10-26

    @lxle Your command line doesn't get processed the way you were expecting. The shell splits it into two commands before sending one of them to roxterm, so roxterm sees -e command1, then afterwards the shell will try to run "-e command2" which is an error.

    You need to explicitly tell roxterm to use a shell to be able to chain commands that way. This seems to work:

    roxterm --geometry 70x30 -T "window title" -e $SHELL -c "command; command2"

    but there may be quoting problems etc if the commands are complicated and include quotes of their own. In that case you could put them in a script and have roxterm run that.

     
  • lxle

    lxle - 2013-10-28

    The format works fine when entered directly into roxterm, however I think I may have an idea what the culprit might be. In 'edit currnt profile' if you set roxterm to 'hold terminal open' in the command setting, this seems to be causing the second command to hang and or not run.

    command;command2 or command && command2

    works fine when entered directly

    but if you open roxterm with a command and run the commands using the hold terminal open settings, the second command is never reached.

     
  • Tony Houghton

    Tony Houghton - 2013-10-28

    I think I misunderstood your original problem, I thought you wanted to run both commands serially in the same terminal. If you want to run them in separate windows you can make the first roxterm run in the background by adding the
    --fork option.

    In general you can run a command in the background of a shell by putting a single & character at the end, but for running multiple roxterms it's better to use its --fork option to avoid race conditions in its start-up.

     
  • lxle

    lxle - 2013-10-29

    I am trying to get both commands to run back to back in the same terminal window. As stated earlier the usual parameters to do such a thing works if entered manually in the terminal window.

    But if I want to open a terminal window with a command then run multiple commands the second command always hangs. The reason you need the hold terminal open option set is to keep roxterm from closing as soon as it runs the command its given.

    in yet other words.
    I set up an icon to launch xterm and run two commands when double clicked on. It opens xterm, runs both the commands entered and then holds the window open so you can view the results. Roxterm will do this also but the second command never runs but the first one does.

     
  • lxle

    lxle - 2013-10-29

    Thanks, really appreciate all the help, but that approach returns the error, "The new terminal's command failed to run: failed to execute child process "$SHELL" (No such file or directory)

     
  • Tony Houghton

    Tony Houghton - 2013-10-29

    To run it from an icon, desktop file or whatever, you need to use /bin/sh or /bin/bash instead of $SHELL.

     
  • lxle

    lxle - 2013-10-29

    sweet, that worked, thanks.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks