I need to run two command in parallel and get the output from both in the same shell.
Edit:
I am trying to run multiple long-running commands that watch the file system and compile various things for me(coffeescript, jade, sass).
I need to run two command in parallel and get the output from both in the same shell.
Edit:
I am trying to run multiple long-running commands that watch the file system and compile various things for me(coffeescript, jade, sass).
You're probably looking at wait command in bash. Consider this script:
#!/bin/bash
FAIL=0
echo "starting"
./script1 &
./script2 &
for job in `jobs -p`
do
echo $job
wait $job || let "FAIL+=1"
done
echo $FAIL
if [ "$FAIL" == "0" ];
then
echo "All jobs completed!"
else
echo "Jobs FAILED: ($FAIL)"
fi
Courtesy
command1 &
command2 &
They're both running in parallel; their output goes to the screen.