diff --git a/tool/tsh/common/proxy.go b/tool/tsh/common/proxy.go index dc357467e65e2..af18d34ec3cf3 100644 --- a/tool/tsh/common/proxy.go +++ b/tool/tsh/common/proxy.go @@ -882,13 +882,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 c05216143045a..e6336f71afed2 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",