MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / replaceHomeAndShell

Function replaceHomeAndShell

pkg/util/pamparse/pamparse.go:115–119  ·  view source on GitHub ↗

Replaces @{HOME} and @{SHELL} placeholders in a string with the provided values. Follows guidance from https://wiki.archlinux.org/title/Environment_variables#Using_pam_env

(val string, home string, shell string)

Source from the content-addressed store, hash-verified

113
114// Replaces @{HOME} and @{SHELL} placeholders in a string with the provided values. Follows guidance from https://wiki.archlinux.org/title/Environment_variables#Using_pam_env
115func replaceHomeAndShell(val string, home string, shell string) string {
116 val = strings.ReplaceAll(val, "@{HOME}", home)
117 val = strings.ReplaceAll(val, "@{SHELL}", shell)
118 return val
119}
120
121// Regex to parse a line from /etc/environment. Follows the guidance from https://wiki.archlinux.org/title/Environment_variables#Using_pam_env
122var envFileLineRe = regexp.MustCompile(`^(?:export\s+)?([A-Z0-9_]+[A-Za-z0-9]*)=(.*)$`)

Callers 1

ParseEnvironmentConfFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected