This script uses /bin/sh, which on Debian-like systems is dash, which does not support bash's pushd/popd.