commit: f1e2aaf13c06e9fb1c4a774ab6de1a5fbcf9eaba
parent: 7f13c534d6e785481dab50b60df3a7f9b606ed0c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Wed, 9 May 2018 06:57:58 +0200
sshpaste: Fix broken logic for exclusive options
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Changelog.md b/Changelog.md
@@ -1,5 +1,6 @@
## HEAD
* Read from stdin when ``-`` is given
+* Fix broken logic for exclusive options
## 1.0.0rc2 — 2018-05-06 21:02
* Add ``-h`` option
diff --git a/sshpaste b/sshpaste
@@ -76,8 +76,8 @@ while getopts "xhc:" opt
do
case $opt in
'c')
- [ -z $flag_x ] && die "Cannot have both -x and -c"
- [ -z $flag_c ] && die "Cannot have two -c, use ; if you want multiple commands"
+ [ ! -z $flag_x ] && die "Cannot have both -x and -c"
+ [ ! -z $flag_c ] && die "Cannot have two -c, use ; if you want multiple commands"
flag_c=1
opt_command="${OPTARG}"
;;
@@ -86,7 +86,7 @@ do
exit 0
;;
'x')
- [ -z $flag_c ] && die "Cannot have both -x and -c"
+ [ ! -z $flag_c ] && die "Cannot have both -x and -c"
flag_x=1
;;
'?')