Reputation: 28760
I have the following bash script:
#!/bin/bash
set -o errexit # Exit on error
# Enable script to run from anywhere
cd "$(dirname ${BASH_SOURCE[0]})"
root=$(pwd)
cd "../../../"
source ./somebashscript
cd "../../../..."
source ./otherbashscript
both source commands will launch their own process.
How do I launch both processes from the same bash script?
Upvotes: 1
Views: 44
Reputation: 11280
Using &
at the end of the command starts the process in the background.
cd "../../../"
source ./somebashscript &
cd "../../../..."
source ./otherbashscript &
You may want to redirect the output of the scripts to somewhere else, otherwise everything will be printed to your screen. You can do that by adding > file.log
if you want to log the output, or > /dev/null
if you want to drop it
source ./somebashscript > /dev/null &
Upvotes: 1