Bash CD || выход
cd "$foo" || { echo "Error xyz"; exit 1; }
AttractivePenguin
cd "$foo" || { echo "Error xyz"; exit 1; }