Browse Source

fix(tmux): improve `ssh_launch.zsh`

Joe 8 months ago
parent
commit
4045616f8c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      .scripts/ssh_launch.zsh

+ 2 - 2
.scripts/ssh_launch.zsh

@@ -1,7 +1,7 @@
 #!/bin/zsh
-LOCATIONS=$(grep -ioE "ssh [a-z0-9]+@[a-z0-9]+\.[a-z0-9]+" $ZDOTDIR/.zsh_history | cut -c 5- | uniq)
+LOCATIONS=$(grep -ioE "^ssh [a-z0-9]+@[a-z0-9\.]+" $ZDOTDIR/.zsh_history | tac | awk '!x[$0]++' | cut -c 5-)
 if [[ $1 =~ '^[0-9]+$' ]] ; then
-    echo $(echo $LOCATIONS | tac | head -n $1)
+    echo $LOCATIONS | head -n $1
     exit
 fi
 if [[ -z "$1" ]]; then