Last active
August 23, 2017 05:54
-
-
Save jfly/7b94cba17c04d344d62a7bea916bb55a to your computer and use it in GitHub Desktop.
bash function to start a screen session with multiple named windows running specified commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function start_screen { | |
NAME=$1 | |
shift | |
screen -dmS "$NAME" -s bash # start screen | |
while test $# -gt 0 | |
do | |
TITLE="$1" | |
shift | |
CMD="$1"$'\n' | |
shift | |
screen -S "$NAME" -X title "$TITLE" # set title of window | |
screen -S "$NAME" -X stuff "$CMD" # run command in window | |
screen -S "$NAME" -X screen # add new window | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment