0

I am trying to write a bash script, but I need multiple tabs in it or terminal. Is it possible to use that in a bash script. I need it, because I use a few commands that need to keep running.

Thank you all and sorry for my English!

3
  • do you mean you need to run multiple processes? you can use fork... Commented Feb 26, 2013 at 19:38
  • Are you familiar with job control, &, ^Z, fg, etc.? Commented Feb 26, 2013 at 19:38
  • as ruakh stated, just apppend a & after a command to send it to the background Commented Feb 26, 2013 at 19:41

1 Answer 1

1

To run a process in the background add & at the end. For example, this runs ls in the background and uses tail to monitor the file that's being written to in the foreground.

ls -lR / > /tmp/ls.out &
tail -f /tmp/ls.out

If at any point you want to wait until the background processes are finished before continuing—perhaps at the end of your script before it exits—use a bare wait command:

wait
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.