# # Workscreen: screen session wrapper # # Alternative: # http://byobu.co # http://packages.debian.org/stable/byobu # # Default options. opts="-c /etc/screenrc" # Remove dead screens. screen -wipe &> /dev/null # Session selection. if [ ! -z "$1" ]; then if screen -ls $1 | grep -q "There is a screen on"; then #echo "There's already a screen called $1" #exit 1 screen -x $1 exit $? else session="-S $1" fi if [ "$1" == "main" ]; then opts="" elif [ "$1" == "root" ]; then sudo screen -x exit elif [ -f "$HOME/.screen/$1" ]; then opts="-c $HOME/.screen/$1" elif [ -f "$HOME/.screen/base" ]; then opts="-c $HOME/.screen/base" fi fi # Start session. screen $opts $session