Commits

James Tocknell committed 7ca7af0

Fixed launching of ssh-agent and showing of login messages

Comments (0)

Files changed (1)

 export LESS="R"
 export LESSHISTFILE="-"
 
+# The current directory should never be in $PATH
+pathremove . PATH
+pathremove "" PATH
+
 # Interactive login stuff
 if [ -t 0 ]; then
+    # Starts ssh-agent if it exists, and isn't running yet
+    if which ssh-agent >/dev/null 2>&1 && test -z $SSH_AGENT_PID ; then
+        eval `ssh-agent` >/dev/null 2>&1
+    fi
     # Starts tmux if it exists
-    if which tmux 2>&1 >/dev/null; then
-        if [ -z "$TMUX"]; then
+    ## THIS MUST BE THE LAST THING WE DO !!!##
+    if which tmux >/dev/null 2>&1; then
+        if [ -z "$TMUX" ]; then
             #if not inside a tmux session, and if no session is started, start a new session
-            if tmux has-session 2>&1 >/dev/null; then
+            if tmux has-session >/dev/null 2>&1; then
+                read -p "Continue? "
                 exec tmux attach
             else
-                exec tmux new-session
+                read -p "Continue? "
+                exec tmux
             fi
         fi
     fi
 fi
-
-# Starts ssh-agent if it exists, and isn't running yet
-if [ -n `which ssh-agent` -a -z $SSH_AGENT_PID ]; then
-    eval `ssh-agent`
-fi
-
-# The current directory should never be in $PATH
-pathremove . PATH
-pathremove "" PATH