0
0
فهرست منبع

fix(tmux): improve `ssh_launch.zsh`

Joe 8 ماه پیش
والد
کامیت
4045616f8c
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  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