spm

Personal fork of spm (simple password manager)

commit 96cd2f60a7cbf4b543bd971885159b53c1fa5493
parent 238e74cf98955f7c0bdbb28858db8765f69be7fb
Author: Klemens Nanni <kl3@posteo.org>
Date: Fri, 16 Sep 2016 01:30:34 +0200

Add password only if directory exists

In case $STORE_DIR/$group could not be created, do not try writing the
password file.
1 file changed, 3 insertions(+), 3 deletions(-)
M
spm.sh
|
6
+++---
diff --git a/spm.sh b/spm.sh
@@ -73,9 +73,9 @@ add() {
 	group="${1%/*}"
 	[ "${group}" = "${1}" ] && group=
 
-	mkdir -p "${STORE_DIR}"/"${group}"/
-	printf '%s\n' "${password}" \
-		| gpg --encrypt --output "${STORE_DIR}"/"${1}".gpg
+	mkdir -p "${STORE_DIR}"/"${group}"/ \
+		&& printf '%s\n' "${password}" \
+			| gpg --encrypt --output "${STORE_DIR}"/"${1}".gpg
 }
 
 list() {