(userNameOrId: string)
| 590 | } |
| 591 | |
| 592 | export function getEntPasswdShellCommand(userNameOrId: string) { |
| 593 | const escapedForShell = userNameOrId.replace(/['\\]/g, '\\$&'); |
| 594 | const escapedForRexExp = escapeRegExCharacters(userNameOrId) |
| 595 | .replaceAll('\'', '\\\''); |
| 596 | // Leading space makes sure we don't concatenate to arithmetic expansion (https://tldp.org/LDP/abs/html/dblparens.html). |
| 597 | return ` (command -v getent >/dev/null 2>&1 && getent passwd '${escapedForShell}' || grep -E '^${escapedForRexExp}|^[^:]*:[^:]*:${escapedForRexExp}:' /etc/passwd || true)`; |
| 598 | } |
no test coverage detected