X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/591c224584c04e0d6f58ece969946bd5472f7c89..bd685982389b78a158921b7839bdeca501338d19:/support/lsh diff --git a/support/lsh b/support/lsh index 8ccc5a26..b63444e3 100755 --- a/support/lsh +++ b/support/lsh @@ -24,10 +24,12 @@ if [ "$user" ]; then prefix='' if [ $do_cd = y ]; then home=`perl -e "print((getpwnam('$user'))[7])"` - prefix="cd '$home' ;" + prefix="cd '$home' &&" fi sudo -H -u "$user" sh -c "$prefix $*" else - [ $do_cd = y ] && cd + if [ $do_cd = y ]; then + cd || exit 1 + fi eval "${@}" fi