diff --git a/src/functions.sh b/src/functions.sh index e9b9da00..2a423a48 100755 --- a/src/functions.sh +++ b/src/functions.sh @@ -12,13 +12,23 @@ VHOST_FILE="$VHOST_DIR/vhosts_all.conf" # Some usefull miscellaneous shell functions print_domain_letter() { - local domain="$1" - - local letter=`echo "$domain" | awk '{z=split($NF, a, ".") ; print substr(a[z-1], 1, 1)}'` - if [ -z "$letter" ]; then - letter="_" - fi - echo $letter +# local domain="$1" +# +# local letter=`echo "$domain" | awk '{z=split($NF, a, ".") ; print substr(a[z-1], 1, 1)}'` +# if [ -z "$letter" ]; then +# letter="_" +# fi +# echo $letter + local domain=$1 + domain=${domain/.${domain/*./}/} + domain=${domain/*./} + domain=${domain:0:1} + # Bash match un é quand on lui donne [a-z]. Etrange + if [[ "$domain" =~ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0-9]{1} ]]; then + echo $domain + else + echo '_' + fi } print_user_letter() { diff --git a/src/update_domains.sh b/src/update_domains.sh index fc1f32c8..279c8105 100644 --- a/src/update_domains.sh +++ b/src/update_domains.sh @@ -123,7 +123,7 @@ if [ ! -z "$(cat "$RELOAD_WEB")" ] ; then # Concat the apaches files tempo=$(mktemp "$VHOST_FILE.XXXXX") - find "$VHOST_DIR" -mindepth 2 -type f -iname "*.conf" -exec cat '{}' > "$tempo" \; + find "$VHOST_DIR" -mindepth 2 -type f -iname "*.conf" -print0 | xargs -0 cat > "$tempo" if [ $? -ne 0 ] ; then log_error " web file concatenation failed" fi