From 8bcd6a4afff3cb8197d5589ec4fdf9fe153f53de Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 7 May 2011 12:58:11 -0700 Subject: [PATCH] Abort if the cd fails. --- support/lsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.34.1