We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I'm trying to change my tmux window name on the fly when i'm connecting to another server through SSH. I tried the following :
preexec() { if [ "$1" == "ssh" ]; then tmux rename-window $3@$1; else tmux rename-window $(whoami)@$(hostname); fi }
After trying ssh myhost -l myuser Preexec does not seem to be executed ...
ssh myhost -l myuser
Am i missing something ?
Thank you, regards, Greg.
The text was updated successfully, but these errors were encountered:
Hey @vroumvroum,
I'm unable to recreate. Could you try using a simpler preexec command to confirm it's getting executed? e.g.
preexec() { echo "«$1»"; }
For example:
$ preexec() { echo "«$1»"; } $ ssh rcaloras@bashhub.com «ssh rcaloras@bashhub.com»
Sorry, something went wrong.
Hey @rcaloras,
Thank you so much for answering. It's working now. I didn't understand that command line arguments were all aggregated into "$1".
So I needed to cut "$1" or make a regex search on it. Here is what I did
preexec() { cmd=$(echo $1 | cut -d " " -f1); if [ "$cmd" == "ssh" ]; then tmux rename-window "$1"; fi } precmd() { tmux rename-window "vroumvroum VDI"; }
Regards, Greg.
Great. Glad to hear everything is good. Thanks for using bash-preexec!
No branches or pull requests
Hello,
I'm trying to change my tmux window name on the fly when i'm connecting to another server through SSH.
I tried the following :
preexec() { if [ "$1" == "ssh" ]; then tmux rename-window $3@$1; else tmux rename-window $(whoami)@$(hostname); fi }
After trying
ssh myhost -l myuser
Preexec does not seem to be executed ...
Am i missing something ?
Thank you, regards, Greg.
The text was updated successfully, but these errors were encountered: