scripts/blind-append: Remove this stupid script

master
Pierre Neidhardt 2016-10-10 17:50:32 +05:30
parent 2a1f543ff5
commit f3c48de930
1 changed files with 0 additions and 45 deletions

View File

@ -1,45 +0,0 @@
#!/usr/bin/env zsh
if [ $# -gt 2 ] || [ $# -lt 1 ] || [ "$1" = "-h" ]; then
cat <<EOF
Usage: ${0##*/} FILE [STRING]
Append to all STRING found in FILE a secret phrase being prompted. If STRING is
omitted, secret phrase will be appended to the end of the file. If FILE does
not exist, it will be created and secret phrase will be inserted. STRING will be
ignored.
This requires 'read -s'. As of Oct 6 2013 it will not work for strictly
POSIX-compliant shells.
This is a stupid program, don't use it.
EOF
exit
fi
FILE="$1"
STRING=""
DUMMY=""
if [ $# -eq 2 ]; then
STRING="$2"
fi
echo -n "Secret: "
read -s DUMMY
echo ""
if [ ! -e "$FILE" ] || [ -z "$STRING" ]; then
echo "$DUMMY" >> "$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}."