Created
December 1, 2023 18:49
-
-
Save cr0cK/1e5914530b1fce142ee9d47b027c7a27 to your computer and use it in GitHub Desktop.
Reattach detached screens
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
#!/bin/bash | |
# Get all detached screen sessions | |
SESSIONS=$(screen -ls | grep Detached | awk '{print $1}') | |
# Check if there are any detached sessions | |
if [ -z "$SESSIONS" ]; then | |
echo "No detached screen sessions found." | |
exit 0 | |
fi | |
# Open each session in a new GNOME Terminal window | |
for SESSION in $SESSIONS | |
do | |
gnome-terminal -- screen -r $SESSION & | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment