From 4ff183c6b378366f3fac2eece30a03bf4a4a9f92 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 1 Mar 2022 10:57:20 +0100
Subject: [PATCH] fix usage with 1st param "name"

---
 dns-api.sh    | 4 ++--
 dns-search.sh | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dns-api.sh b/dns-api.sh
index 5cf612f..bef15ec 100755
--- a/dns-api.sh
+++ b/dns-api.sh
@@ -27,8 +27,8 @@
 
 # ----- read cli params
 method=GET
-echo "$1" | grep -E "^(GET|PUT|POST|DELETE)$" >/dev/null
-if [ $? -eq 0 ]; then
+if echo "$1" | grep -E "^(GET|PUT|POST|DELETE)$" >/dev/null
+then
     method=$1
     shift 1
 fi
diff --git a/dns-search.sh b/dns-search.sh
index dcfcec9..21a8869 100755
--- a/dns-search.sh
+++ b/dns-search.sh
@@ -6,6 +6,7 @@
 # ----------------------------------------------------------------------
 # 2021-10-29  v1.0  <axel.hahn@iml.unibe.ch>
 # 2022-01-14  v1.0  <axel.hahn@iml.unibe.ch>  1st public version
+# 2022-03-01  v1.1  <axel.hahn@iml.unibe.ch>  fix usage with 1st param "name"
 # ======================================================================
 
 
@@ -39,8 +40,8 @@ exit 0
 fi
 
 mytype=name
-echo "$1" | grep -E '^(host|alias)$' >/dev/null
-if [ $? -eq 0 ]; then
+if echo "$1" | grep -E '^(name|alias)$' >/dev/null
+then
     mytype=$1
     shift 1
 fi
-- 
GitLab