#!/usr/bin/env bash# This will be executed as the following# history -c && echo "BASE64STRING==" | /path/to/script.sh# Without this the script might report a success# if something fails in the script.set-opipefail-eIFS=read-rparamsjson=$(echo"$params"|base64-d)# There is no built int JSON parser.# In order to parse JSON, a tool like jq or fx is required.$( echo"$json"|jq-r'keys[] as $k | "export \($k)=\(.[$k])"' )# Requires htpasswd from apache2-utils (Ubuntu) or httpd-tools (CentOS)# Note: -c option creates new file but if file already exists it overwrites and truncateshtpasswd-b~/path/to/pwdfile $user $newPassword