diff --git a/tool/tsh/common/proxy.go b/tool/tsh/common/proxy.go index 4817be079d3c4..aeaf15459ed9c 100644 --- a/tool/tsh/common/proxy.go +++ b/tool/tsh/common/proxy.go @@ -875,13 +875,13 @@ func envVarDefaultFormat() string { func envVarCommand(format, key, value string) (string, error) { switch format { case envVarFormatUnix: - return fmt.Sprintf("export %s=%s", key, value), nil + return fmt.Sprintf(`export %s="%s"`, key, value), nil case envVarFormatWindowsCommandPrompt: return fmt.Sprintf("set %s=%s", key, value), nil case envVarFormatWindowsPowershell: - return fmt.Sprintf("$Env:%s=\"%s\"", key, value), nil + return fmt.Sprintf(`$Env:%s="%s"`, key, value), nil case envVarFormatText: return fmt.Sprintf("%s=%s", key, value), nil diff --git a/tool/tsh/common/proxy_test.go b/tool/tsh/common/proxy_test.go index 04c39356f1298..b4b3a6982a27a 100644 --- a/tool/tsh/common/proxy_test.go +++ b/tool/tsh/common/proxy_test.go @@ -837,7 +837,7 @@ func TestEnvVarCommand(t *testing.T) { inputFormat: envVarFormatUnix, inputKey: "key", inputValue: "value", - expectOutput: "export key=value", + expectOutput: `export key="value"`, }, { inputFormat: envVarFormatWindowsCommandPrompt, @@ -849,7 +849,7 @@ func TestEnvVarCommand(t *testing.T) { inputFormat: envVarFormatWindowsPowershell, inputKey: "key", inputValue: "value", - expectOutput: "$Env:key=\"value\"", + expectOutput: `$Env:key="value"`, }, { inputFormat: "unknown",