From 8af310d0a248df2a8daab17b53d0bed3b79e50c0 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Wed, 31 Jul 2024 10:01:49 +0200 Subject: [PATCH] Fix bug on cd "" --- zsh/preserve-cwd-ssh.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 }