# Render a systemd EnvironmentFile; never source the result as shell code. # A trailing newline in an agenix password file is not part of the password. set -eu umask 077 password=$(cat "$1") escaped=$(printf '%s' "$password" | sed 's/\\/\\\\/g; s/"/\\"/g') printf 'LDAP_BIND_PW="%s"\n' "$escaped" > "$2" chmod 600 "$2"