Jump to content

Recommended Posts

Posted (edited)

Hi all, I have been trying to write a simple script to automate some tasks but i have hit a point where I just can't figure this out.

I want to run multiple commands simultaneously in foreground (in different console windows) so somewhat like this:

konsole command1
konsole command2
konsole commant3

but the problem is that it waits for the first command to finish before executing the second one but the commands do not end (the aren't supposed to) and so it never starts the next command because it waits for the first command to finish and it never finishes.

I have also tried this:

konsole command1 &
konsole command2 &
konsole command3

however, this doesn't work for me either because this makes em all run in background and not in foreground.

I just want it to run all those commands in foreground so can you guys please help me with this.

Thanks

Edited by Bhawan
Posted

I don't know of an way to do that. You could probably just write up a script for each command and then run it in a separate konsole window.

Posted

Create a script for each command, then in a new script, start all of them with the & at the end of the line and they should all run in the background. To see them in a console, I think you just type jobs, then it gives you a # and the script name. You can then do fg # to bring it to the front.

http://linuxreviews.org/beginner/jobs/

ex: launch.sh

#!/bin/bash

script1 &
script2 &
script3 &
script4 &

Posted (edited)
Create a script for each command, then in a new script, start all of them with the & at the end of the line and they should all run in the background. To see them in a console, I think you just type jobs, then it gives you a # and the script name. You can then do fg # to bring it to the front.

http://linuxreviews.org/beginner/jobs/

ex: launch.sh

#!/bin/bash

script1 &
script2 &
script3 &
script4 &

Thank you very much :D I'll give it a shot when I finish my homework.

BTW: Is there a way I can filter out the job id for a specific process and then copy that to a variable so that later on i can just go " fg $VARIABLE " ?

thanks

Edited by Bhawan

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...