Tmux breaks zsh aliases

618 Views Asked by At

I have a file .aliases that I point to in my .zshrc file

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -f $DIR"/.aliases" ]; then
    . $DIR"/.aliases"
fi

This code is the same in my .bashrc file (in the process of switching over to zsh). The aliases work fine when I open a new terminal - however when I change directory and open tmux, the aliases break. At first I thought this had something to do with whether the directory is the correct one - however, when I switch to bash, it works! So I am very confused as to what is causing this issue.

1

There are 1 best solutions below

0
On BEST ANSWER

BASH_SOURCE cannot be used in .zshrc, because it is a bash-specific variable that isn't defined in zsh. You'll have to replace it with its zsh equivalent, found here.