diff --git a/zsh/preserve-cwd-ssh.zsh b/zsh/preserve-cwd-ssh.zsh index e290b28..7169955 100644 --- a/zsh/preserve-cwd-ssh.zsh +++ b/zsh/preserve-cwd-ssh.zsh @@ -5,7 +5,12 @@ if [ "$PRESERVE_SSH_CWD" = "true" ]; then # Alias for cd: when we change directory, we write the new cwd in the file corresponding to the terminal uuid cd() { - builtin cd "$1" + if [ -z "$1" ]; then + directory=$HOME + else + directory="$1" + fi + builtin cd "$directory" pwd > $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd }