1. cd to root dir before removing temp installer path. It was failing because we were trying to remove while being in the same dir. 2. Expand variables in a regular string and use it in the command. Expansion was failing in single quotes.