Improve example hooks and remove bashisms in them.