#!/usr/bin/env zsh if [ $# -gt 2 ] || [ $# -lt 1 ] || [ "$1" = "-h" ]; then cat <> "$FILE" echo "Secret appended to ${FILE} at the end." exit fi if [ $# -eq 1 ]; then echo "$DUMMY" >> "$FILE" else ex -sc "%s/${STRING}/${STRING}${DUMMY}/g|xit" "${FILE}" fi echo "Secret appended to ${FILE}."