I'm trying to figure out how to create a command called
runbg that will accept sub-commands to run in the background and create a split screen for each sub-command. When a sub-command completes successfully, the split screen is closed; if a sub-command fails, then the screen stays open with the error until the user closes the screen with the terminate signal. Once all screens are closed, the command is complete and execution continues. E.g.
runbg "ping -t 5 google.com" "ping -t 10 microsoft.com" echo "done"
I've discovered I can do:
ping -t 5 google.com & ping -t 10 microsoft.com & wait
Which accomplishes the parallel side of things, however each command outputs everything to the same terminal, which is very noisy. Hence the desire for a split screen setup.
From searching here, I've discovered GNU Screen which seems to handle the screen side of things, but it seems it requires a .screenrc file - which while possible to do programmatically, is a bit annoying, as I'd imagine it would mean I would need to write a random tmp file somewhere.
I found this answer which goes into using screen without the
.sreenrc however I cannot figure out how to do the split screen stuff in it.
So in short:
- Is there something that already does the functionality that I'm aiming for with
- If not, is GNU Screen what I want for this? Do I need to use a
.screenrcfile, or is there a way to accomplish the split screens without one?