Expand environment variables and ~ in workdir path