diff --git a/Scripts/Bash/Functions/Shell/shell.sh b/Scripts/Bash/Functions/Shell/shell.sh index 1138463..40a17d2 100755 --- a/Scripts/Bash/Functions/Shell/shell.sh +++ b/Scripts/Bash/Functions/Shell/shell.sh @@ -26,23 +26,9 @@ function shell { + # Define variables. local FILES='' - # Define list of files to process using option value as reference. - if [[ -d $OPTIONVAL ]];then - FILES=$(find $OPTIONVAL -regextype posix-egrep -type f -regex "^${REGEX}\.sh$") - elif [[ -f $OPTIONVAL ]];then - FILES=$OPTIONVAL - fi - - # Check list of files to process. If list of files is empty there - # is nothing to do except to print a message and end script - # execution. - if [[ $FILES == '' ]];then - cli_printMessage "`gettext "There is no file to process."`" - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - # Define command-line interface. shell_getActions diff --git a/Scripts/Bash/Functions/Shell/shell_getActions.sh b/Scripts/Bash/Functions/Shell/shell_getActions.sh index 6b91e47..ca12b5f 100755 --- a/Scripts/Bash/Functions/Shell/shell_getActions.sh +++ b/Scripts/Bash/Functions/Shell/shell_getActions.sh @@ -29,7 +29,7 @@ function shell_getActions { # Evaluate option name and define which actions does centos-art.sh # script supports. - case $OPTIONNAM in + case $ACTIONNAM in '--update-copyright' ) # Update copyright note inside top comments. diff --git a/Scripts/Bash/Functions/Shell/shell_updateCopyright.sh b/Scripts/Bash/Functions/Shell/shell_updateCopyright.sh index bee26ed..01e02cc 100755 --- a/Scripts/Bash/Functions/Shell/shell_updateCopyright.sh +++ b/Scripts/Bash/Functions/Shell/shell_updateCopyright.sh @@ -121,6 +121,38 @@ function shell_updateCopyright { done + # Define short options we want to support. + local ARGSS="" + + # Define long options we want to support. + local ARGSL="filter:" + + # Parse arguments using getopt(1) command parser. + cli_doParseArguments + + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" + + # Define action to take for each option passed. + while true; do + case "$1" in + --filter ) + REGEX="$2" + shift 2 + ;; + * ) + break + esac + done + + # Re-define regular expression to match shell files only. + REGEX=$(echo "${REGEX}\.(bash|shell|sh)") + + # Define list of files to process. + cli_getFilesList + + # Process list of files. for FILE in $FILES;do # Output action message.