From 5f7579b6aa39e0e5b97c7ffe7f15e5d0cf766435 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Mar 07 2011 23:51:14 +0000 Subject: Update `identity' functionality: - Improve construction of array index. Stop using arithmetic substitution `$((EXPRESSION))'. Start using arithmetic expression `((EXPRESSION))' instead. - Start using the variable pre-increment construction `++ID' to increment the variable that control the array index value. --- diff --git a/Scripts/Bash/Cli/Functions/Identity/identity_render.sh b/Scripts/Bash/Cli/Functions/Identity/identity_render.sh index ae17275..d2d6800 100755 --- a/Scripts/Bash/Cli/Functions/Identity/identity_render.sh +++ b/Scripts/Bash/Cli/Functions/Identity/identity_render.sh @@ -66,7 +66,7 @@ function identity_render { # required in order for centos-art.sh to know when to apply # last-rendition actions. for FILE in $(cli_getFilesList "${TEMPLATE}" "${FLAG_FILTER}.*${EXTENSION}");do - FILES[$((${#FILES[*]} - 1 + 1))]=$FILE + FILES[((++${#FILES[*]}))]=$FILE done # Set action preamble. diff --git a/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgLastActions.sh b/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgLastActions.sh index 88a7ed5..a9a0c43 100644 --- a/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgLastActions.sh +++ b/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgLastActions.sh @@ -46,11 +46,11 @@ function identity_renderSvgLastActions { # combinations each time you need to produce images inside the # repository. if [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Gdm/.+\.svg$" ]];then - LASTACTIONS[$((${#LASTACTIONS[*]} - 1 + 1))]='renderDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' + LASTACTIONS[((++${#LASTACTIONS[*]}))]='renderDm:Gdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Kdm/.+\.svg$" ]];then - LASTACTIONS[$((${#LASTACTIONS[*]} - 1 + 1))]='renderDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' + LASTACTIONS[((++${#LASTACTIONS[*]}))]='renderDm:Kdm:800x600 1024x768 1280x1024 1360x768 2048x1536 2560x1240' elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Ksplash/.+\.svg$" ]];then - LASTACTIONS[$((${#LASTACTIONS[*]} - 1 + 1))]='renderKsplash' + LASTACTIONS[((++${#LASTACTIONS[*]}))]='renderKsplash' fi # At this point centos-art.sh should be producing the last file diff --git a/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgPostActions.sh b/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgPostActions.sh index 286cfbc..bf7a5f9 100644 --- a/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgPostActions.sh +++ b/Scripts/Bash/Cli/Functions/Identity/identity_renderSvgPostActions.sh @@ -40,16 +40,16 @@ function identity_renderSvgPostActions { # combinations each time you need to produce images inside the # repository. if [[ $TEMPLATE =~ "Distro/Backgrounds/.+\.svg$" ]];then - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderFormats: jpg' - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='groupByFormat: png jpg' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderFormats: jpg' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='groupByFormat: png jpg' elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Syslinux/.+\.svg$" ]];then - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderSyslinux' - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderSyslinux:-floyd' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderSyslinux' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderSyslinux:-floyd' elif [[ $TEMPLATE =~ "Grub" ]];then - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderGrub' - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderGrub:-floyd' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderGrub' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderGrub:-floyd' elif [[ $TEMPLATE =~ "Distro/$(cli_getPathComponent '--release-pattern')/Ksplash/.+\.svg$" ]];then - POSTACTIONS[$((${#POSTACTIONS[*]} - 1 + 1))]='renderKsplash' + POSTACTIONS[((++${#POSTACTIONS[*]}))]='renderKsplash' fi for ACTION in "${POSTACTIONS[@]}"; do