spm

Personal fork of spm (simple password manager)

commit 62546d41691cc7870a7f219b003790a5281e61c9
parent 96cd2f60a7cbf4b543bd971885159b53c1fa5493
Author: Klemens Nanni <kl3@posteo.org>
Date: Fri, 16 Sep 2016 03:10:32 +0200

Fix off-by-one, use && not '-a'

'-a' as logical AND as well as it's precedence over '-o' is not always
defined.
1 file changed, 2 insertions(+), 2 deletions(-)
M
spm.sh
|
4
++--
diff --git a/spm.sh b/spm.sh
@@ -103,7 +103,7 @@ show() {
 ## Parse input
 
 [ ${#} -eq 0 ] || [ ${#} -gt 3 ] \
-|| [ ${#} -eq 3 -a "${1}" != list ] \
+|| [ ${#} -eq 3 ] && [ "${1}" != list ] \
 	&& usage 'Wrong number of arguments'
 
 case "${1}" in

@@ -114,7 +114,7 @@ case "${1}" in
 	list)
 		if [ "${2}" = -g ] && [ ${#} -le 3 ]; then
 			groups_only=1; shift 1
-		elif [ ${#} -gt 3 ]; then
+		elif [ ${#} -gt 2 ]; then
 			usage 'Wrong number of arguments'
 		fi
 		list	"${2}"