Remove set uo and no capital chars in alias

This commit is contained in:
Antonio J. Delgado 2024-06-21 09:48:55 +03:00
parent 89ae8b6220
commit 7ac4acd5ef

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -uo pipefail
# shellcheck disable=SC1091 # shellcheck disable=SC1091
[ -r /var/lib/from_repos/ad_scripts/shared_functions.sh ] && . /var/lib/from_repos/ad_scripts/shared_functions.sh [ -r /var/lib/from_repos/ad_scripts/shared_functions.sh ] && . /var/lib/from_repos/ad_scripts/shared_functions.sh
function usage() { function usage() {
@ -98,7 +98,7 @@ fi
while [ "${alias}" == "" ] while [ "${alias}" == "" ]
do do
random_string=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c "${alias_length}") random_string=$(LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c "${alias_length}")
existing=$(echo "SELECT source FROM mail.forwardings where source = '${random_string}@${domain}';" |mysql mail |grep -v '^source$') existing=$(echo "SELECT source FROM mail.forwardings where source = '${random_string}@${domain}';" |mysql mail |grep -v '^source$')
if [ -z "${existing}" ]; then if [ -z "${existing}" ]; then
alias="${random_string}@${domain}" alias="${random_string}@${domain}"