diff --git a/tool/tsh/common/proxy.go b/tool/tsh/common/proxy.go index 698c62883ca68..9cd7c48c947b0 100644 --- a/tool/tsh/common/proxy.go +++ b/tool/tsh/common/proxy.go @@ -786,13 +786,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 d4a90ed7a3bba..f0df8e6aa71f3 100644 --- a/tool/tsh/common/proxy_test.go +++ b/tool/tsh/common/proxy_test.go @@ -816,7 +816,7 @@ func TestEnvVarCommand(t *testing.T) { inputFormat: envVarFormatUnix, inputKey: "key", inputValue: "value", - expectOutput: "export key=value", + expectOutput: `export key="value"`, }, { inputFormat: envVarFormatWindowsCommandPrompt, @@ -828,7 +828,7 @@ func TestEnvVarCommand(t *testing.T) { inputFormat: envVarFormatWindowsPowershell, inputKey: "key", inputValue: "value", - expectOutput: "$Env:key=\"value\"", + expectOutput: `$Env:key="value"`, }, { inputFormat: "unknown",