### Description
The `kamctl` tool seems to require `bash`, while trying to use `/bin/sh`, which can point to `dash` or other shell interpreters.
For example, the output of `kamdbctl create`:
``` MySQL password for root: -e \E[37;33mINFO: creating database kamailio_simple_db ... -e \E[37;33mINFO: granting privileges to database kamailio_simple_db ... -e \E[37;33mINFO: creating standard tables into kamailio_simple_db ... -e \E[37;33mINFO: Core Kamailio tables succesfully created. Install presence related tables? (y/n): n /usr/sbin/kamdbctl: 216: /usr/sbin/kamdbctl: Bad substitution ```
It seems that the issue is expanding the variable when getting the answer for y/n question:
* https://github.com/kamailio/kamailio/blob/master/utils/kamctl/kamdbctl.base#...
Such expression seems to be specific for bash:
* https://mywiki.wooledge.org/Bashism
### Troubleshooting
#### Reproduction
Run `kamctl` with `/bin/sh` pointing to `bash`.
### Possible Solutions
Decide what to do to have an acceptable solution: enforce `bash`, remove bashisms`...
Or maybe focus to make `kamcli` a (full) replacement for `kamctl/kamdbctl` and get rid of those old-style shell/bash scripts:
* https://github.com/kamailio/kamcli
May be this ```sh #!/bin/sh
get_answer () { 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/') }
get_answer ask "My question?" ```
Thanks @sergey-safarov, I replaced the existing function with the one you proposed until getting to a decision on kamcli vs kamctl+bash/shell.
This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.
Closed #2019 as not planned.