John Smith
John Smith

Reputation: 1

Multiple terminals in bash scripting

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!

Upvotes: 0

Views: 214

Answers (1)

John Kugelman
John Kugelman

Reputation: 361585

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

Upvotes: 1

Related Questions