#!/bin/bash replaceHexKeys() { local file="$1" # Only scan for hex placeholders that actually exist in the file local existing_placeholders=$(runCfgOp grep -oE 'RANDOMIZEDHEX[0-9]*' "$file" 2>/dev/null | sort -u) if [[ -n "$existing_placeholders" ]]; then while IFS= read -r placeholder; do if [[ -n "$placeholder" ]]; then local hex_key hex_key=$(openssl rand -hex 32) runCfgOp sed -i "s/${placeholder}/${hex_key}/g" "$file" checkSuccess "Updated ${placeholder} in $(basename "$file") with a new hex key." fi done <<< "$existing_placeholders" fi }