Module: kamailio
Branch: master
Commit: 88d06a08a8baf460188745f1d748dd83f275356f
URL:
https://github.com/kamailio/kamailio/commit/88d06a08a8baf460188745f1d748dd8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-09-16T10:12:47+02:00
kamctl: kamdbctl.base - replaced get_answer() with a portable version
- contributed by Sergey Safarov, GH #2019
---
Modified: utils/kamctl/kamdbctl.base
---
Diff:
https://github.com/kamailio/kamailio/commit/88d06a08a8baf460188745f1d748dd8…
Patch:
https://github.com/kamailio/kamailio/commit/88d06a08a8baf460188745f1d748dd8…
---
diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base
index 7029fd386e..3846196b20 100644
--- a/utils/kamctl/kamdbctl.base
+++ b/utils/kamctl/kamdbctl.base
@@ -205,16 +205,11 @@ merr() {
#
get_answer ()
{
- value=$1
- question=$2
- if [ "${value}" = "ask" ]; then
- echo -n "$question"
- read ANSWER
- else
- ANSWER=${value}
- fi
- ANSWER=${ANSWER:0:1}
- ANSWER=${ANSWER/Y/y}
- ANSWER=${ANSWER/N/n}
+ value=$1
+ question=$2
+ if [ "${value}" = "ask" ]; then
+ echo -n "$question"
+ read value
+ fi
+ ANSWER=$(echo ${value} | grep -o -e '[YyNn]' | sed -e 's/Y/y/' -e
's/N/n/')
}
-