From: Wayne Davison Date: Sat, 7 May 2011 19:58:11 +0000 (-0700) Subject: Abort if the cd fails. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/8bcd6a4afff3cb8197d5589ec4fdf9fe153f53de Abort if the cd fails. --- 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