0
0
Эх сурвалжийг харах

fix(tmux): improve `ssh_launch.zsh`

Joe 8 сар өмнө
parent
commit
4045616f8c

+ 2 - 2
.scripts/ssh_launch.zsh

@@ -1,7 +1,7 @@
 #!/bin/zsh
 #!/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
 if [[ $1 =~ '^[0-9]+$' ]] ; then
-    echo $(echo $LOCATIONS | tac | head -n $1)
+    echo $LOCATIONS | head -n $1
     exit
     exit
 fi
 fi
 if [[ -z "$1" ]]; then
 if [[ -z "$1" ]]; then