Quote Originally Posted by geirha View Post
Be careful with cd in scripts. If cd fails, you'll be issuing commands in the wrong directory. In this case, the tar will probably just fail, but what if it was rm for instance?

Good practice is to always check the return value of cd. E.g.
cd /some/path || exit 1
Thanks for the insight, makes alot of sence.