check if remote path exists

This commit is contained in:
Thomas Avé 2024-04-21 21:29:22 +02:00
parent 2e2e3d59c9
commit 122c2ef51c
1 changed files with 3 additions and 1 deletions

View File

@ -203,7 +203,9 @@ function zvm_after_init() {
echo $$ > /tmp/ssh_sessions/"$SSH_SESSION_ID"
fi
if [ "$REMOTE_PATH" != "" ]; then
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