aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-08-25 12:46:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-08-25 12:46:43 -0300
commitfa96f3264871a023b703787cc16816b35fb9ce15 (patch)
tree71e3f69a623d678b1e8c8681782485764d924b06 /shell
parentc24b3de5600fcae43869a6f31445c101f10f5870 (diff)
downloadscripts-fa96f3264871a023b703787cc16816b35fb9ce15.tar.gz
scripts-fa96f3264871a023b703787cc16816b35fb9ce15.tar.bz2
Make shell script more logical
Diffstat (limited to 'shell')
-rwxr-xr-xshell15
1 files changed, 10 insertions, 5 deletions
diff --git a/shell b/shell
index 5fb417b..d8ff48f 100755
--- a/shell
+++ b/shell
@@ -18,10 +18,15 @@ if [ "$BASENAME" == "shells" ]; then
else
autossh $DEST -t -- screen -x $COMMAND
fi
-elif [ "$BASENAME" == "shelll" ]; then
- # Local screen shell
- wscreen $*
else
- # Remote shell using autossh
- autossh $DEST -t -- $COMMAND
+ if [ -z "$COMMAND" ] && screen -ls $DEST | grep -q "There is a screen on"; then
+ # Local existing screen shell
+ wscreen $DEST
+ elif [ "$DEST" == "local" ]; then
+ # Local screen shell
+ wscreen $COMMAND
+ else
+ # Remote shell using autossh
+ autossh $DEST -t -- $COMMAND
+ fi
fi