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)
| 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 |
| 115 | func 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 |
| 122 | var envFileLineRe = regexp.MustCompile(`^(?:export\s+)?([A-Z0-9_]+[A-Za-z0-9]*)=(.*)$`) |
no outgoing calls
no test coverage detected