diff --git a/Scripts/Bash/Functions/Html/html_getActions.sh b/Scripts/Bash/Functions/Html/html_getActions.sh index ed4236a..04ad590 100755 --- a/Scripts/Bash/Functions/Html/html_getActions.sh +++ b/Scripts/Bash/Functions/Html/html_getActions.sh @@ -59,7 +59,7 @@ function html_getActions { case "$3" in -f|--filter ) # Redefine regular expression. - REGEX="$4" + FLAG_FILTER="$4" # Rotate positional parameters shift 4 ;; @@ -85,7 +85,7 @@ function html_getActions { fi # Redefine regular expression to match html files only. - REGEX=$(echo "${REGEX}.*\.(html|htm)") + FLAG_FILTER=$(echo "${FLAG_FILTER}.*\.(html|htm)") # Execute action name. if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then diff --git a/Scripts/Bash/Functions/Locale/locale_doMessagesStatus.sh b/Scripts/Bash/Functions/Locale/locale_doMessagesStatus.sh index 7ab522f..86f0544 100755 --- a/Scripts/Bash/Functions/Locale/locale_doMessagesStatus.sh +++ b/Scripts/Bash/Functions/Locale/locale_doMessagesStatus.sh @@ -71,7 +71,7 @@ function locale_doMessagesStatus { echo "$LOCALECODE | $LANG_NAME | $LANG_COUNTRY | $PO_STATUS | $PO_REVDATE | $PO_LASTAUTHOR" done \ - | egrep -i $REGEX \ + | egrep -i $FLAG_FILTER \ | awk 'BEGIN {FS="|"; format ="%7s\t%-15s\t%-15s\t%-12s\t%-12s\t%-s\n" printf "--------------------------------------------------------------------------------\n" printf format, "'`gettext "Code"`'", " '`gettext "Language"`'", " '`gettext "Country"`'",\ diff --git a/Scripts/Bash/Functions/Locale/locale_getActions.sh b/Scripts/Bash/Functions/Locale/locale_getActions.sh index 6b9586a..b94e55d 100644 --- a/Scripts/Bash/Functions/Locale/locale_getActions.sh +++ b/Scripts/Bash/Functions/Locale/locale_getActions.sh @@ -58,7 +58,7 @@ function locale_getActions { -f|--filter ) # Redefine regular expression. - REGEX="$3" + FLAG_FILTER="$3" # Rotate positional parameters shift 3 diff --git a/Scripts/Bash/Functions/Render/Config/Translations/Identity/Brands/render.conf.sh b/Scripts/Bash/Functions/Render/Config/Translations/Identity/Brands/render.conf.sh index 31edf1c..b8e3473 100755 --- a/Scripts/Bash/Functions/Render/Config/Translations/Identity/Brands/render.conf.sh +++ b/Scripts/Bash/Functions/Render/Config/Translations/Identity/Brands/render.conf.sh @@ -119,7 +119,7 @@ function render_loadConfig { # can reduce the amount of translation templates to process # using the string regex as pattern. for FILE in $(find $TXT/Tpl -regextype posix-egrep \ - -regex "^.+/$REGEX\.sed$" | sort );do + -regex "^.+/$FLAG_FILTER\.sed$" | sort );do # Define translation path. TRANSLATION=$FILE diff --git a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh index 81db2ba..4cb7e79 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh @@ -115,7 +115,7 @@ function render_doIdentityGroupByType { # (without duplications). for FILE in $(find $ACTIONVAL -regextype posix-egrep -type f -regex ${PATTERNS[2]} \ | sed -r 's!\.[[:alpha:]]{1,4}$!!' | sort | uniq \ - | egrep $REGEX);do + | egrep $FLAG_FILTER);do FILES[$COUNT]="$FILE" COUNT=$(($COUNT + 1)) done diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh b/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh index 4b34e63..6c4d25f 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh @@ -32,7 +32,7 @@ function render_doIdentityImageKsplash { local KSPLASH_TOP='' local KSPLASH_PREVIEW='' local RELDIRS=$(find $ACTIONVAL -regextype posix-egrep -maxdepth 1 \ - -type d -regex "^.*/${RELEASE_FORMAT}$" | egrep $REGEX) + -type d -regex "^.*/${RELEASE_FORMAT}$" | egrep $FLAG_FILTER) # Define font file used to render Preview.png bottom text. local KSPLASH_PREVIEW_FONT=/home/centos/artwork/trunk/Identity/Fonts/Ttf/DejaVuLGCSans-Bold.ttf diff --git a/Scripts/Bash/Functions/Render/render_getActions.sh b/Scripts/Bash/Functions/Render/render_getActions.sh index 1f3a393..c1148e9 100644 --- a/Scripts/Bash/Functions/Render/render_getActions.sh +++ b/Scripts/Bash/Functions/Render/render_getActions.sh @@ -71,7 +71,7 @@ function render_getActions { --filter ) # Redefine filter (regular expression) flag. - REGEX="$2" + FLAG_FILTER="$2" # Rotate positional parameters shift 2 diff --git a/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh b/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh index 68c2504..7d4510e 100755 --- a/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh +++ b/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh @@ -106,16 +106,16 @@ function render_getActionsTranslations { # release-specific directories. Otherwise, all release-specific # translations directories available in the current location will # be affected. - if [[ $REGEX =~ "^${RELEASE_FORMAT}$" ]];then - RELEASES=$ACTIONVAL/$REGEX + if [[ $FLAG_FILTER =~ "^${RELEASE_FORMAT}$" ]];then + RELEASES=$ACTIONVAL/$FLAG_FILTER # Re-define releases using regular expression value. If you need # to create/update two or more release-specific directories (e.g., # 5, 5.1, 5.2, and 6.0), you can use a command similar to # 'centos-art render --translation=./ --filter=5,5.1,5.2,6.0' to # create them all using just one command. - elif [[ $REGEX =~ "^(${RELEASE_FORMAT},?)+" ]];then - for RELEASE in $(echo $REGEX | tr ',' ' ');do + elif [[ $FLAG_FILTER =~ "^(${RELEASE_FORMAT},?)+" ]];then + for RELEASE in $(echo $FLAG_FILTER | tr ',' ' ');do RELEASES="$RELEASES $RELEASE" done diff --git a/Scripts/Bash/Functions/Render/render_getFilesList.sh b/Scripts/Bash/Functions/Render/render_getFilesList.sh index a731ce7..c6af32b 100644 --- a/Scripts/Bash/Functions/Render/render_getFilesList.sh +++ b/Scripts/Bash/Functions/Render/render_getFilesList.sh @@ -62,11 +62,11 @@ function render_getFilesList { fi - # Make regular expression (REGEX) variable local (to avoid + # Make regular expression (FLAG_FILTER) variable local (to avoid # concatenation the next time cli_getFilesList function be # called), and redefine it to match files with specific extensions # inside specific locations. - local REGEX="${REGEX}.*\.${EXTENSION}" + local FLAG_FILTER="${FLAG_FILTER}.*\.${EXTENSION}" # Define list of files to process. cli_getFilesList "$LOCATION" diff --git a/Scripts/Bash/Functions/Shell/shell_getActions.sh b/Scripts/Bash/Functions/Shell/shell_getActions.sh index f979956..3af39b8 100755 --- a/Scripts/Bash/Functions/Shell/shell_getActions.sh +++ b/Scripts/Bash/Functions/Shell/shell_getActions.sh @@ -62,7 +62,7 @@ function shell_getActions { case "$3" in --filter ) # Redefine regular expression. - REGEX="$4" + FLAG_FILTER="$4" # Rotate positional parameters shift 4 ;; @@ -89,7 +89,7 @@ function shell_getActions { fi # Re-define regular expression to match shell files only. - REGEX=$(echo "${REGEX}.*\.(bash|shell|sh)") + FLAG_FILTER=$(echo "${FLAG_FILTER}.*\.(bash|shell|sh)") # Execute action name. if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then diff --git a/Scripts/Bash/Functions/Svg/svg_getActions.sh b/Scripts/Bash/Functions/Svg/svg_getActions.sh index 806fc84..2120ca0 100755 --- a/Scripts/Bash/Functions/Svg/svg_getActions.sh +++ b/Scripts/Bash/Functions/Svg/svg_getActions.sh @@ -65,7 +65,7 @@ function svg_getActions { --filter ) # Redefine regular expression. - REGEX="$4" + FLAG_FILTER="$4" # Rotate positional parameters. shift 4 @@ -103,7 +103,7 @@ function svg_getActions { --filter ) # Redefine regular expression. - REGEX="$4" + FLAG_FILTER="$4" # Rotate positional parameters. shift 4 @@ -133,7 +133,7 @@ function svg_getActions { # Re-define regular expression to match scalable vector graphic # files only. - REGEX=$(echo "${REGEX}.*\.(svgz|svg)") + FLAG_FILTER=$(echo "${FLAG_FILTER}.*\.(svgz|svg)") # Execute action name. if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then diff --git a/Scripts/Bash/Functions/Verify/verify_doEnvironment.sh b/Scripts/Bash/Functions/Verify/verify_doEnvironment.sh index dcbdf69..10eddd5 100755 --- a/Scripts/Bash/Functions/Verify/verify_doEnvironment.sh +++ b/Scripts/Bash/Functions/Verify/verify_doEnvironment.sh @@ -49,7 +49,7 @@ function verify_doEnvironment { # Let user to reduce output using regular expression as # reference. - if [[ ${VARS[$COUNT]} =~ $REGEX ]];then + if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then # Output list of environment variables using indirect # expansion (what a beautiful feature!) to output variable diff --git a/Scripts/Bash/Functions/Verify/verify_doPackageReport.sh b/Scripts/Bash/Functions/Verify/verify_doPackageReport.sh index bb84ea6..95a755a 100755 --- a/Scripts/Bash/Functions/Verify/verify_doPackageReport.sh +++ b/Scripts/Bash/Functions/Verify/verify_doPackageReport.sh @@ -37,7 +37,7 @@ function verify_doPackageReport { for PACKAGE in ${PACKAGES_MISSING[@]};do # Is this package from third party? - if [[ $PACKAGE =~ $PACKAGES_THIRD_REGEX ]];then + if [[ $PACKAGE =~ $PACKAGES_THIRD_FLAG_FILTER ]];then WARNING=" (`gettext "requires third party repository!"`)" fi diff --git a/Scripts/Bash/Functions/Verify/verify_doPackages.sh b/Scripts/Bash/Functions/Verify/verify_doPackages.sh index 6854305..77ab1df 100644 --- a/Scripts/Bash/Functions/Verify/verify_doPackages.sh +++ b/Scripts/Bash/Functions/Verify/verify_doPackages.sh @@ -31,7 +31,7 @@ function verify_doPackages { local PACKAGES='' - local PACKAGES_THIRD_REGEX='' + local PACKAGES_THIRD_FLAG_FILTER='' local -a PACKAGES_MISSING local PACKAGES_COUNT=0 @@ -43,7 +43,7 @@ function verify_doPackages { # Define, from required packages, packages being from third # parties (i.e., packages not included in CentOS [base] # repository.). - PACKAGES_THIRD_REGEX="(inkscape|blender)" + PACKAGES_THIRD_FLAG_FILTER="(inkscape|blender)" verify_doPackageCheck verify_doPackageReport diff --git a/Scripts/Bash/Functions/Verify/verify_getActions.sh b/Scripts/Bash/Functions/Verify/verify_getActions.sh index 3741eeb..0739c81 100755 --- a/Scripts/Bash/Functions/Verify/verify_getActions.sh +++ b/Scripts/Bash/Functions/Verify/verify_getActions.sh @@ -57,7 +57,7 @@ function verify_getActions { --filter ) # Redefine regular expression. - REGEX="$3" + FLAG_FILTER="$3" # Rotate positional parameters. shift 3 @@ -87,7 +87,7 @@ function verify_getActions { --filter ) # Redefine regular expression. - REGEX="$3" + FLAG_FILTER="$3" # Rotate positional parameters. shift 3 @@ -117,7 +117,7 @@ function verify_getActions { --filter ) # Redefine regular expression. - REGEX="$3" + FLAG_FILTER="$3" # Rotate positional parameters shift 3 diff --git a/Scripts/Bash/Functions/cli.sh b/Scripts/Bash/Functions/cli.sh index 552dab6..8e00eed 100644 --- a/Scripts/Bash/Functions/cli.sh +++ b/Scripts/Bash/Functions/cli.sh @@ -36,19 +36,25 @@ function cli { local FUNCCONFIG='' local ACTIONNAM='' local ACTIONVAL='' - local REGEX='' local ARGUMENTS='' - # Define default value to verbosity flag. The verbosity flag + # Initialize default value to verbosity flag. The verbosity flag # (--quiet) controls wether centos-art.sh script prints messages # or not. local FLAG_QUIET='false' - # Define default value to answer flag. The answer flag (--yes) + # Initialize default value to answer flag. The answer flag (--yes) # controls wether centos-art.sh script does or does not pass # confirmation request points. local FLAG_YES='false' + # Initialize default value to filter flag. The filter flag + # (--filter) is used mainly to reduce the number of files to + # process. The value of this variable is interpreted as + # egrep-posix regular expression. As initial value, we use a + # regular expression that matches everything. + local FLAG_FILTER='.+' + # Redefine positional parameters stored inside ARGUMENTS variable. cli_doParseArgumentsReDef "$@" @@ -98,11 +104,6 @@ function cli { # Check text editor execution rights. cli_checkFiles $EDITOR 'x' - # Initialize regular expression (REGEX) used to reduce file - # processing. If no regular expression is defined, set regular - # expression to match everything. - REGEX='.+' - # Go for function initialization. Keep the cli_getFunctions # function calling after all variables and arguments definitions. cli_getFunctions diff --git a/Scripts/Bash/Functions/cli_getFilesList.sh b/Scripts/Bash/Functions/cli_getFilesList.sh index 005b87a..edb65d4 100755 --- a/Scripts/Bash/Functions/cli_getFilesList.sh +++ b/Scripts/Bash/Functions/cli_getFilesList.sh @@ -37,8 +37,8 @@ function cli_getFilesList { LOCATION="$ACTIONVAL" fi - # Define regular expression (REGEX) local variable, using regular - # expression (REGEX) global variable, to reduce the amount of + # Define regular expression (FLAG_FILTER) local variable, using regular + # expression (FLAG_FILTER) global variable, to reduce the amount of # characters we type in order to match find's output. When using # regular expression with find, in order to reduce the amount # files found, the regular expression is evaluated against the @@ -49,11 +49,11 @@ function cli_getFilesList { # typing, we prepare the regular expression here to match the # whole path using the regular expression provided by the user as # pattern. - local REGEX="^${LOCATION}/${REGEX}$" + local FLAG_FILTER="^${LOCATION}/${FLAG_FILTER}$" # Define list of files to process. if [[ -d $LOCATION ]];then - FILES=$(find $LOCATION -regextype posix-egrep -type f -regex "${REGEX}" | sort) + FILES=$(find $LOCATION -regextype posix-egrep -type f -regex "${FLAG_FILTER}" | sort) elif [[ -f $LOCATION ]];then FILES=$LOCATION fi