only backup cleartext file if it exists

Avoids complaints from `cp` about nonexistent files.
This commit is contained in:
Shiva Kaul 2023-03-19 00:17:27 -04:00 committed by Ryan Mulligan
parent daf42cb35b
commit 4c48606094

View file

@ -155,7 +155,7 @@ function edit {
decrypt "$FILE" "$KEYS" || exit 1 decrypt "$FILE" "$KEYS" || exit 1
cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before" [ ! -f "$CLEARTEXT_FILE" ] || cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"
[ -t 0 ] || EDITOR='cp /dev/stdin' [ -t 0 ] || EDITOR='cp /dev/stdin'