Skip to content

Instantly share code, notes, and snippets.

@apie
Last active December 2, 2020 20:49
Show Gist options
  • Save apie/bd51d876bf5e5354f8cefc0d0c8a2d8e to your computer and use it in GitHub Desktop.
Save apie/bd51d876bf5e5354f8cefc0d0c8a2d8e to your computer and use it in GitHub Desktop.
Asks to attach screen, only if we are not already in a screen session.
#!/bin/bash
screen -list
if [ $? -eq 0 ] && [ -z "$STY" ]
then
echo -n "Attach screen session? (Y/n)"
read answer
if [ "$answer" == "" ] || [ "$answer" != "${answer#[Yy]}" ] ;then
screen -UraAd
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment