Sample Header Ad - 728x90

Why this exec command only works in zshrc but not in profile?

1 vote
1 answer
158 views
This question is going to be so simple but I need to know how this just works in on side but in other place don't, to end ssh sesion when tmux closes I used the answer proposed in this link: https://stackoverflow.com/a/17465215 I placed similar code inside my /etc/zsh/zprofile and it works, but if I put the same code in /etc/profile the tmux session ends immediately after ssh login, what is happening? PS: The code in question is this:
if [[ -z $TMUX && -n $SSH_TTY ]]; then
     exec tmux -2 new-session -s $TTY
fi
Asked by AxelAGBL (33 rep)
Jun 29, 2023, 02:45 PM
Last activity: Jul 2, 2023, 01:35 AM