Abort if the cd fails.

This commit is contained in:
Wayne Davison committed 2011-05-07 13:01:21 -07:00
1 parent 58663df432
commit 8bcd6a4aff
1 file changed
+4 -2
+4 -2
View File
@@ -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