You don't need to tell bash to wait if the processes you're executing run in the foreground (which everything you show above does) - it will block waiting for them to exit.
Once they exit, bash can examine the return code and behave differently based on that. The return code of the last subprocess is stored in the $? variable:
if [ $? -ne 0 ]; then
echo "Sorry, yum update had non-zero exit code, why don't we stop here?"
yum install libvpx-devel
Note that the Unix convention is that a return code of 0 means a process succeeded and a return code of anything else means there were issues. The issues might be simple (e.g., grep failed to find the string you were looking for) or more complex.
Also note that you can use the && and || operators to leverage the return code in a one-liner:
yum update && echo "yum succeeded"
yum update || echo "yum failed"
Response to @Contax questions in comment:
The connection between "yum update" and "$?" is that every program that runs has an exit code that is returned to the operating system. It will generally default to 0 (success) if the program doesn't specify, but can be specified in the program (e.g., the "exit 1" shown in the script above is setting the exit code of that script to 1. In C, "return(-1)" in the main() function will cause the program to have an exit code of -1.) Bash automatically reads this exit code and stuffs it into $? for your use. Just think of it as part of the plumbing - it's behind the walls, and it makes everything work.
If you have a lot of tasks to execute, yes, this gets tedious. That's why 95% of shell scripts out there don't do any error checking and blow up in spectacular fashions when something goes wrong :) You would have to create an
if [ $? -ne 0 ]; then clause for each task. If you were really adventurous you could find a way to wrap your executions into a loop and re-use the code, but that would probably be more trouble than it's worth.
The || shorthand is useful for compromising between code simplicity and error checking. As you've noticed writing an
if clause for everything is a PITA, but
yum update || exit 1 will cause your script to quickly and quietly bail upon that process's failure. Less friendly than taking the time to print out info and clean up, but better than continuing to run commands that are doomed to fail because an earlier step failed.