added quotes around the variables in my trucate_pwd if statements

prevents "-bash: [: too many arguments" errors