From 122c2ef51c3853a72dd5e251380fcc53144e4777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Sun, 21 Apr 2024 21:29:22 +0200 Subject: [PATCH] check if remote path exists --- .config/zsh/.zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 6a3ab71..b242018 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -203,7 +203,9 @@ function zvm_after_init() { echo $$ > /tmp/ssh_sessions/"$SSH_SESSION_ID" fi if [ "$REMOTE_PATH" != "" ]; then - cd "$REMOTE_PATH" + if [ -d "$REMOTE_PATH" ]; then + cd "$REMOTE_PATH" + fi elif [ "$PREVIOUS_SESSION_ID" != "" ]; then cd "$(readlink -e /proc/$(cat /tmp/ssh_sessions/$PREVIOUS_SESSION_ID)/cwd)" fi