Commit 8bcd6a4a authored by Wayne Davison's avatar Wayne Davison

Abort if the cd fails.

parent 58663df4
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment