1
1
mirror of https://github.com/ryantm/agenix.git synced 2024-07-14 17:30:27 +03:00

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
cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"
[ ! -f "$CLEARTEXT_FILE" ] || cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"
[ -t 0 ] || EDITOR='cp /dev/stdin'