create leading directories if they don't exist

This works for files without directories too because `dirname` prints
`.` in that case.
This commit is contained in:
Charles Hall 2023-11-03 14:57:48 -07:00
parent 05591973d7
commit 65fe5959c3
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -181,6 +181,8 @@ function edit {
@ageBin@ "${ENCRYPT[@]}" <"$CLEARTEXT_FILE" || exit 1 @ageBin@ "${ENCRYPT[@]}" <"$CLEARTEXT_FILE" || exit 1
mkdir -p "$(dirname "$FILE")"
mv -f "$REENCRYPTED_FILE" "$FILE" mv -f "$REENCRYPTED_FILE" "$FILE"
} }