]> gitweb.fluxo.info Git - scripts.git/commitdiff
Make shell script more logical
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 25 Aug 2013 15:46:43 +0000 (12:46 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 25 Aug 2013 15:46:43 +0000 (12:46 -0300)
shell
shelll [deleted symlink]

diff --git a/shell b/shell
index 5fb417bd2c8fb7d831a36724bb5130f53a702200..d8ff48fa940aa29b99ee4e24010a7a284c367735 100755 (executable)
--- 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
diff --git a/shelll b/shelll
deleted file mode 120000 (symlink)
index 03e813f..0000000
--- a/shelll
+++ /dev/null
@@ -1 +0,0 @@
-shell
\ No newline at end of file