Abort if the cd fails.
authorWayne Davison <wayned@samba.org>
Sat, 7 May 2011 19:58:11 +0000 (12:58 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 7 May 2011 20:01:21 +0000 (13:01 -0700)
support/lsh

index 8ccc5a2..b63444e 100755 (executable)
@@ -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