Home > Net >  Is there a program to run different commands simoultaneously in BASH terminal?
Is there a program to run different commands simoultaneously in BASH terminal?

Time:10-22

I tried using GNU Parallel, but I couldn't find a way to run simoultaneously commands such as top and ls.

CodePudding user response:

You can use wait to do something like that:

#!/bin/bash    
ls &
declare ls_pid=$!
top &
declare top_pid=$! 
wait "$ls_pid" "$top_pid"

$! capture the background job pid and wait simply wait for them to exit.

Or you could use tmux and have two windows, one with ls, one with top.

  • Related