On Windows, connecting to tmux 1.8 on CentOS 7 through MobaXterm.
Ideally, I want my tmux windows to have the name of the last command that I typed in whichever pane is active (like, cd /home not bash like {pane_current_command} prints). I have no idea how to do that, so instead I'm trying to find out how to get the name match the PS1 of the active pane. I tried the suggestions in this answer with this in my bashrc:
settitle() {
printf "\033k$1\033\\"
}
basic_prompt='${USER:0:3}@${PWD:${#PWD}<15?0:(-15)}'
PROMPT_COMMAND='if [ $? -eq 0 ]; then ((counter++)); else counter=0; fi; settitle($basic_prompt)'
PS1='(\[\e[4m\]${USER:0:3}\[\e[0m\]@\[\e[34m\]${PWD:${#PWD}<15?0:(-15)}\[\e[m\])[$counter]\\$ '
and got
bash: PROMPT_COMMAND: line 10: syntax error near unexpected token '$basic_prompt'
Is there any way to name a tmux window by the last completed command?
If not, how can I correctly get it to set to my
PS1, which is dynamic based on my username and path?