5

Best practice for if/else when one outcome results in exit [Bash]

view full story
linux-howto

https://bbs.archlinux.org – The situation dictates.Another alternative would be something lilkefunction fail() { case $1 in lvchange) <error message, save tmp, etc> ;; mount) <other error message + cleanup> ;; esac exit $err_code } echo -n "activating lv ..." echo "activating lv" >> $log lvchange -val "$lv" &> "$tmp" || fail lvchange ... mount "$lv" "$dir" &>"$tmp" || fail mountedit: D'Oh, upon rereading, I'm guessing this is about what you meant by using a function instea (HowTos)