X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/591c224584c04e0d6f58ece969946bd5472f7c89..4591bb2f6651cf8efd707b6b815a3d62a1c9c418:/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