blob: ace84f5b3bfe2eb023f83461970d0a0e4b403739 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#
# 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"
fi
fi
# Start session.
screen $opts $session
|