-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It wont find my previous ssh connections on bash/zsh #6
Comments
Hey mate here is a working solution if your zsh history file looks like this : : 1612859817:0;composer require box/spout
: 1612860397:0;serve
: 1612864497:0;g stash
: 1612864547:0;serve
: 1612864918:0;git stash pop
: 1612864923:0;serve
: 1612865778:0;q
: 1612867006:0;g stash
: 1612867185:0;g stash pop
: 1612867186:0;q
: 1612867375:0;g stash
: 1612868268:0;g stash pop
: 1612875694:0;g status` Just change the ssh-history() function to : ssh-history() {
cat "$HISTFILE" | grep -E "ssh\s" | sed 's/.*;//'| sed -e 's/\s*$//' | sort | uniq -c | sort -nr | sed -e "s/^\s*[0-9]*\s//"
} |
Thanks for replying @XpliSyL I am using my own alias shortcuts since 2019. What about that list box, I tried to use it but it's just echoing? |
I don't know much about list box. But as I understood list box just echo in a pleasant way the list that you give him. I had the same probem as yours as my list of last ssh connection was empty because of the wrong regex pattern in the sed. |
Hmm, I corrected the ssh-history line on ssh-connect.sh but I am still having an empty list here.. do I need to check my alias or something? I am just doing ssh-connect from the same directory :/ |
I guess that your zsh history file is different than mine... Show me the output of this command : cat $HISTFILE | head -n 5 And I'll find the right regex sed expression that you need. |
Hmm, this is what I get:
|
Hmmmm it's definitly the same format. So if your history file contain some commands like ssh username@ssh.server.com It should return the line. When you do : cat $HISTFILE | grep ssh Do you have some ssh commands ? My last hypothesis would be that list box might not work on your system (macos). I tested it in debian and I don't have any problem. If the last commands return you some ssh lines and list box don't show them then I won't be able to help you anymore :( |
salut jutilise oh my zsh jai installer le plugin en manuelle dans le dossier /opt et quand jexecute il ne maffiche pas le connection ssh avant pourtant quand jaffiche mon $histfile jai bien mon historique peut tu maider stp |
Really glad to find this little useful utility for (recent) ssh connections.
I am trying to find out why I get a connect: empty list while I am using it on macos (10.14) with zsh.
I managed to run the ssh-history command (cat "$HISTFILE" | grep -E "^ssh\s" | sed -e 's/\s*$//' | sort | uniq -c | sort -nr | sed -e "s/^\s*[0-9]*\s//") on bash and I got the history lines contain ssh. But otherwise I cannot make it to work.
The text was updated successfully, but these errors were encountered: