diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index 33f1379c4f8..63f428dd06f 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -492,8 +492,8 @@ def shell_modifications(self, shell='sh'): if new is None: cmds += _shell_unset_strings[shell].format(name) else: - cmds += _shell_set_strings[shell].format(name, - new_env[name]) + cmds += _shell_set_strings[shell].format( + name, cmd_quote(new_env[name])) return cmds @staticmethod