commit 651ddc681c6258d516e6449cdb2eb40ccecded0d
parent 1b947eb7ad06e67317a1b681b78ba36911799ee7
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date: Sat, 16 Nov 2024 10:39:08 +0000
Newline litteral is stored in a dedicated variable
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/pashage.sh b/src/pashage.sh
@@ -16,6 +16,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+NL='
+'
+
#############################
# INTERNAL HELPER FUNCTIONS #
#############################
@@ -646,8 +649,7 @@ do_generate_commit() {
elif [ -e "${PREFIX}/$1.age" ] && [ "${MULTILINE}" = yes ]; then
printf '%s\n' "Decrypting previous secret for $1"
OLD_SECRET_FULL="$(do_decrypt "${PREFIX}/$1.age")"
- OLD_SECRET="${OLD_SECRET_FULL#*
-}"
+ OLD_SECRET="${OLD_SECRET_FULL#*"${NL}"}"
WIP_FILE="$(mktemp "${PREFIX}/$1-XXXXXXXXX.age")"
OVERWRITE=once
if [ "${OLD_SECRET}" = "${OLD_SECRET_FULL}" ]; then