great guide with many examples:

http://tille.xalasys.com/training/bash/