#!/bin/bash function check_db_maria_exists() { db-maria list | grep -q "^$1$" } function check_db_postgres_exists() { db-psql list | grep -q "$1" } function extract_domain_from_fqdn() { fqdn=$1 part1=$(builtin echo "$fqdn" | rev | cut -d'.' -f1 | rev) part2=$(builtin echo "${fqdn%."$part1"}" | rev | cut -d'.' -f1 | rev) builtin echo "$part2.$part1" } function extract_subdomain_from_fqdn() { fqdn=$1 domain=$(extract_domain_from_fqdn "$fqdn") builtin echo "${fqdn%."$domain"}" }