From f3c33b125b3d0a228684c968b2d0965869ab998c Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 7 Jun 2025 20:42:17 -0500 Subject: [PATCH] Cleanup: The script styling practices. Over time my scripting style practices have changed. Up date these older scripts. The variables should always have braces (makes compatibilty with other shells like ZSH easier). Add additional lines in certain places. Make comments proper sentences by making first letter upper case. --- level_3/fake/data/build/process_post.sh | 206 ++++++++++++++++---------------- level_3/fake/data/build/process_pre.sh | 204 +++++++++++++++---------------- 2 files changed, 207 insertions(+), 203 deletions(-) diff --git a/level_3/fake/data/build/process_post.sh b/level_3/fake/data/build/process_post.sh index c00efa9..58866ad 100755 --- a/level_3/fake/data/build/process_post.sh +++ b/level_3/fake/data/build/process_post.sh @@ -16,7 +16,7 @@ process_post_main() { local p= local t=0 - # custom color codes. + # Custom color codes. local c_reset="\\033[0m" local c_title="\\033[1;33m" local c_error="\\033[1;31m" @@ -27,7 +27,7 @@ process_post_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - # the supported parameters. + # The supported parameters. local operation= local defines= local modes= @@ -39,7 +39,7 @@ process_post_main() { local path_work= local verbosity=normal - # generated paths and standard paths. + # Generated paths and standard paths. local path_directory_separator="/" local path_data_build= local path_documents="documents/" @@ -57,12 +57,12 @@ process_post_main() { local path_work_programs_shared= local path_work_programs_static= - # generated file paths. + # Generated file paths. local file_data_build_dependencies= local file_data_build_settings= local file_documents_readme= - # standard build paths. + # Standard build paths. local path_build_documents= local path_build_includes= local path_build_libraries= @@ -77,87 +77,88 @@ process_post_main() { local path_build_programs_static= local path_build_settings= - # grab all supported parameters, ignoring duplicates. - if [[ $# -gt 0 ]] ; then - t=$# + # Grab all supported parameters, ignoring duplicates. + if [[ ${#} -gt 0 ]] ; then + t=${#} - while [[ $i -lt $t ]] ; do - let i=$i+1 + while [[ ${i} -lt ${t} ]] ; do + + let i++ p="${!i}" - if [[ $grab_next == "" ]] ; then - if [[ $p == "build" || $p == "clean" || $p == "make" || $p == "skeleton" ]] ; then - if [[ $operation == "" ]] ; then - operation=$p + if [[ ${grab_next} == "" ]] ; then + if [[ ${p} == "build" || ${p} == "clean" || ${p} == "make" || ${p} == "skeleton" ]] ; then + if [[ ${operation} == "" ]] ; then + operation=${p} fi - elif [[ $p == "-d" || $p == "--define" ]] ; then + elif [[ ${p} == "-d" || ${p} == "--define" ]] ; then grab_next="defines" - elif [[ $p == "-m" || $p == "--mode" ]] ; then + elif [[ ${p} == "-m" || ${p} == "--mode" ]] ; then grab_next="modes" - elif [[ $p == "-p" || $p == "--process" ]] ; then + elif [[ ${p} == "-p" || ${p} == "--process" ]] ; then grab_next="process" - elif [[ $p == "-s" || $p == "--settings" ]] ; then + elif [[ ${p} == "-s" || ${p} == "--settings" ]] ; then grab_next="file_settings" - elif [[ $p == "-b" || $p == "--build" ]] ; then + elif [[ ${p} == "-b" || ${p} == "--build" ]] ; then grab_next="path_build" - elif [[ $p == "-D" || $p == "--data" ]] ; then + elif [[ ${p} == "-D" || ${p} == "--data" ]] ; then grab_next="path_data" - elif [[ $p == "-S" || $p == "--sources" ]] ; then + elif [[ ${p} == "-S" || ${p} == "--sources" ]] ; then grab_next="path_sources" - elif [[ $p == "-w" || $p == "--work" ]] ; then + elif [[ ${p} == "-w" || ${p} == "--work" ]] ; then grab_next="path_work" - elif [[ $p == "+D" || $p == "++debug" ]] ; then + elif [[ ${p} == "+D" || ${p} == "++debug" ]] ; then verbosity=debug - elif [[ $p == "+E" || $p == "++error" ]] ; then + elif [[ ${p} == "+E" || ${p} == "++error" ]] ; then verbosity=error - elif [[ $p == "+N" || $p == "++normal" ]] ; then + elif [[ ${p} == "+N" || ${p} == "++normal" ]] ; then verbosity=normal - elif [[ $p == "+Q" || $p == "++quiet" ]] ; then + elif [[ ${p} == "+Q" || ${p} == "++quiet" ]] ; then verbosity=quiet - elif [[ $p == "+V" || $p == "++verbose" ]] ; then + elif [[ ${p} == "+V" || ${p} == "++verbose" ]] ; then verbosity=verbose - elif [[ $p == "+l" || $p == "++light" ]] ; then + elif [[ ${p} == "+l" || ${p} == "++light" ]] ; then do_color=light - elif [[ $p == "+d" || $p == "++dark" ]] ; then + elif [[ ${p} == "+d" || ${p} == "++dark" ]] ; then do_color=dark - elif [[ $p == "+n" || $p == "++no_color" ]] ; then + elif [[ ${p} == "+n" || ${p} == "++no_color" ]] ; then do_color=none fi else - if [[ $grab_next == "defines" ]] ; then - if [[ $defines == "" ]] ; then - defines=$p + if [[ ${grab_next} == "defines" ]] ; then + if [[ ${defines} == "" ]] ; then + defines=${p} else - defines="$defines $p" + defines="${defines} ${p}" fi - elif [[ $grab_next == "modes" ]] ; then - if [[ $modes == "" ]] ; then - modes=$p + elif [[ ${grab_next} == "modes" ]] ; then + if [[ ${modes} == "" ]] ; then + modes=${p} else - modes="$modes $p" + modes="${modes} ${p}" fi - elif [[ $grab_next == "process" ]] ; then - process="$p" - elif [[ $grab_next == "file_settings" ]] ; then - file_settings="$p" - elif [[ $grab_next == "path_build" ]] ; then - path_build=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_build" ]] ; then - path_source_build=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_codes" ]] ; then - path_source_codes=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_common" ]] ; then - path_source_common=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_data" ]] ; then - path_source_data=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_documents" ]] ; then - path_source_documents=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_licenses" ]] ; then - path_source_licenses=$(process_post_path_fix $p) - elif [[ $grab_next == "path_source_settings" ]] ; then - path_source_settings=$(process_post_path_fix $p) - elif [[ $grab_next == "path_work" ]] ; then - path_work=$(process_post_path_fix $p) + elif [[ ${grab_next} == "process" ]] ; then + process="${p}" + elif [[ ${grab_next} == "file_settings" ]] ; then + file_settings="${p}" + elif [[ ${grab_next} == "path_build" ]] ; then + path_build=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_build" ]] ; then + path_source_build=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_codes" ]] ; then + path_source_codes=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_common" ]] ; then + path_source_common=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_data" ]] ; then + path_source_data=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_documents" ]] ; then + path_source_documents=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_licenses" ]] ; then + path_source_licenses=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_source_settings" ]] ; then + path_source_settings=$(process_post_path_fix ${p}) + elif [[ ${grab_next} == "path_work" ]] ; then + path_work=$(process_post_path_fix ${p}) fi grab_next= @@ -167,14 +168,14 @@ process_post_main() { p= fi - if [[ $do_color == "light" ]] ; then + if [[ ${do_color} == "light" ]] ; then c_error="\\033[1;31m" c_warning="\\033[0;31m" c_title="\\033[1;34m" c_highlight="\\033[0;34m" c_notice="\\033[0;01m" c_important="\\033[0;35m" - elif [[ $do_color == "none" ]] ; then + elif [[ ${do_color} == "none" ]] ; then c_reset= c_title= c_error= @@ -186,65 +187,66 @@ process_post_main() { c_prefix= fi - # update paths based on parameters. - path_data_build="${path_data}build$path_directory_separator" - - path_sources_bash="${path_sources}bash$path_directory_separator" - path_sources_c="${path_sources}c$path_directory_separator" - path_sources_cpp="${path_sources}c++$path_directory_separator" - - path_build_documents="${path_build}documents$path_directory_separator" - path_build_includes="${path_build}includes$path_directory_separator" - path_build_libraries="${path_build}libraries$path_directory_separator" - path_build_libraries_script="${path_build_libraries}script$path_directory_separator" - path_build_libraries_shared="${path_build_libraries}shared$path_directory_separator" - path_build_libraries_static="${path_build_libraries}static$path_directory_separator" - path_build_objects="${path_build}objects$path_directory_separator" - path_build_process="${path_build}process$path_directory_separator" - path_build_programs="${path_build}programs$path_directory_separator" - path_build_programs_script="${path_build_programs}script$path_directory_separator" - path_build_programs_shared="${path_build_programs}shared$path_directory_separator" - path_build_programs_static="${path_build_programs}static$path_directory_separator" - path_build_settings="${path_build}settings$path_directory_separator" - - if [[ $path_work != "" ]] ; then - path_work_includes="${path_work}includes$path_directory_separator" - path_work_libraries="${path_work_libraries}libraries$path_directory_separator" - path_work_libraries_script="${path_work_libraries_script}script$path_directory_separator" - path_work_libraries_shared="${path_work_libraries_shared}shared$path_directory_separator" - path_work_libraries_static="${path_work_libraries_static}static$path_directory_separator" - path_work_programs="${path_work_programs}programs$path_directory_separator" - path_work_programs_script="${path_work_programs_script}script$path_directory_separator" - path_work_programs_shared="${path_work_programs_shared}shared$path_directory_separator" - path_work_programs_static="${path_work_programs_static}static$path_directory_separator" + # Update paths based on parameters. + path_data_build="${path_data}build${path_directory_separator}" + + path_sources_bash="${path_sources}bash${path_directory_separator}" + path_sources_c="${path_sources}c${path_directory_separator}" + path_sources_cpp="${path_sources}c++${path_directory_separator}" + + path_build_documents="${path_build}documents${path_directory_separator}" + path_build_includes="${path_build}includes${path_directory_separator}" + path_build_libraries="${path_build}libraries${path_directory_separator}" + path_build_libraries_script="${path_build_libraries}script${path_directory_separator}" + path_build_libraries_shared="${path_build_libraries}shared${path_directory_separator}" + path_build_libraries_static="${path_build_libraries}static${path_directory_separator}" + path_build_objects="${path_build}objects${path_directory_separator}" + path_build_process="${path_build}process${path_directory_separator}" + path_build_programs="${path_build}programs${path_directory_separator}" + path_build_programs_script="${path_build_programs}script${path_directory_separator}" + path_build_programs_shared="${path_build_programs}shared${path_directory_separator}" + path_build_programs_static="${path_build_programs}static${path_directory_separator}" + path_build_settings="${path_build}settings${path_directory_separator}" + + if [[ ${path_work} != "" ]] ; then + path_work_includes="${path_work}includes${path_directory_separator}" + path_work_libraries="${path_work_libraries}libraries${path_directory_separator}" + path_work_libraries_script="${path_work_libraries_script}script${path_directory_separator}" + path_work_libraries_shared="${path_work_libraries_shared}shared${path_directory_separator}" + path_work_libraries_static="${path_work_libraries_static}static${path_directory_separator}" + path_work_programs="${path_work_programs}programs${path_directory_separator}" + path_work_programs_script="${path_work_programs_script}script${path_directory_separator}" + path_work_programs_shared="${path_work_programs_shared}shared${path_directory_separator}" + path_work_programs_static="${path_work_programs_static}static${path_directory_separator}" fi file_data_build_dependencies="${path_data_build}dependencies" file_data_build_settings="${path_data_build}settings" file_documents_readme="${path_documents}readme" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then echo - echo -e "${c_title}Completed Operation: $c_reset$c_notice$operation$c_reset" + echo -e "${c_title}Completed Operation: ${c_reset}${c_notice}${operation}${c_reset}" - if [[ $modes != "" ]] ; then - echo -e " Modes: $c_reset$c_notice$modes$c_reset" + if [[ ${modes} != "" ]] ; then + echo -e " Modes: ${c_reset}${c_notice}${modes}${c_reset}" fi - if [[ $defines != "" ]] ; then - echo -e " Defines: $c_reset$c_notice$defines$c_reset" + if [[ ${defines} != "" ]] ; then + echo -e " Defines: ${c_reset}${c_notice}${defines}${c_reset}" fi fi - # cleanup and return. + # Clean up and return. unset process_post_main unset process_post_path_fix + return 0 } process_post_path_fix() { - echo -n $* | sed -e "s|^${path_directory_separator}${path_directory_separator}*|${path_directory_separator}|" -e "s|${path_directory_separator}*$|${path_directory_separator}|" + echo -n ${*} | sed -e "s|^${path_directory_separator}${path_directory_separator}*|${path_directory_separator}|" -e "s|${path_directory_separator}*$|${path_directory_separator}|" } -# note: "$@" is necessary to preserve quoted arguments when passing to function. +# Note: "$@" is necessary to preserve quoted arguments when passing to function. process_post_main "$@" diff --git a/level_3/fake/data/build/process_pre.sh b/level_3/fake/data/build/process_pre.sh index 1f4c785..469af56 100755 --- a/level_3/fake/data/build/process_pre.sh +++ b/level_3/fake/data/build/process_pre.sh @@ -16,7 +16,7 @@ process_pre_main() { local p= local t=0 - # custom color codes. + # Custom color codes. local c_reset="\\033[0m" local c_title="\\033[1;33m" local c_error="\\033[1;31m" @@ -27,7 +27,7 @@ process_pre_main() { local c_subtle="\\033[1;30m" local c_prefix="\\" - # the supported parameters. + # The supported parameters. local operation= local defines= local modes= @@ -39,7 +39,7 @@ process_pre_main() { local path_work= local verbosity=normal - # generated paths and standard paths. + # Generated paths and standard paths. local path_directory_separator="/" local path_data_build= local path_documents="documents/" @@ -57,12 +57,12 @@ process_pre_main() { local path_work_programs_shared= local path_work_programs_static= - # generated file paths. + # Generated file paths. local file_data_build_dependencies= local file_data_build_settings= local file_documents_readme= - # standard build paths. + # Standard build paths. local path_build_documents= local path_build_includes= local path_build_libraries= @@ -77,87 +77,88 @@ process_pre_main() { local path_build_programs_static= local path_build_settings= - # grab all supported parameters, ignoring duplicates. - if [[ $# -gt 0 ]] ; then - t=$# + # Grab all supported parameters, ignoring duplicates. + if [[ ${#} -gt 0 ]] ; then + t=${#} - while [[ $i -lt $t ]] ; do - let i=$i+1 + while [[ ${i} -lt ${t} ]] ; do + + let i++ p="${!i}" - if [[ $grab_next == "" ]] ; then - if [[ $p == "build" || $p == "clean" || $p == "make" || $p == "skeleton" ]] ; then - if [[ $operation == "" ]] ; then - operation=$p + if [[ ${grab_next} == "" ]] ; then + if [[ ${p} == "build" || ${p} == "clean" || ${p} == "make" || ${p} == "skeleton" ]] ; then + if [[ ${operation} == "" ]] ; then + operation=${p} fi - elif [[ $p == "-d" || $p == "--define" ]] ; then + elif [[ ${p} == "-d" || ${p} == "--define" ]] ; then grab_next="defines" - elif [[ $p == "-m" || $p == "--mode" ]] ; then + elif [[ ${p} == "-m" || ${p} == "--mode" ]] ; then grab_next="modes" - elif [[ $p == "-p" || $p == "--process" ]] ; then + elif [[ ${p} == "-p" || ${p} == "--process" ]] ; then grab_next="process" - elif [[ $p == "-s" || $p == "--settings" ]] ; then + elif [[ ${p} == "-s" || ${p} == "--settings" ]] ; then grab_next="file_settings" - elif [[ $p == "-b" || $p == "--build" ]] ; then + elif [[ ${p} == "-b" || ${p} == "--build" ]] ; then grab_next="path_build" - elif [[ $p == "-D" || $p == "--data" ]] ; then + elif [[ ${p} == "-D" || ${p} == "--data" ]] ; then grab_next="path_data" - elif [[ $p == "-S" || $p == "--sources" ]] ; then + elif [[ ${p} == "-S" || ${p} == "--sources" ]] ; then grab_next="path_sources" - elif [[ $p == "-w" || $p == "--work" ]] ; then + elif [[ ${p} == "-w" || ${p} == "--work" ]] ; then grab_next="path_work" - elif [[ $p == "+D" || $p == "++debug" ]] ; then + elif [[ ${p} == "+D" || ${p} == "++debug" ]] ; then verbosity=debug - elif [[ $p == "+E" || $p == "++error" ]] ; then + elif [[ ${p} == "+E" || ${p} == "++error" ]] ; then verbosity=error - elif [[ $p == "+N" || $p == "++normal" ]] ; then + elif [[ ${p} == "+N" || ${p} == "++normal" ]] ; then verbosity=normal - elif [[ $p == "+Q" || $p == "++quiet" ]] ; then + elif [[ ${p} == "+Q" || ${p} == "++quiet" ]] ; then verbosity=quiet - elif [[ $p == "+V" || $p == "++verbose" ]] ; then + elif [[ ${p} == "+V" || ${p} == "++verbose" ]] ; then verbosity=verbose - elif [[ $p == "+l" || $p == "++light" ]] ; then + elif [[ ${p} == "+l" || ${p} == "++light" ]] ; then do_color=light - elif [[ $p == "+d" || $p == "++dark" ]] ; then + elif [[ ${p} == "+d" || ${p} == "++dark" ]] ; then do_color=dark - elif [[ $p == "+n" || $p == "++no_color" ]] ; then + elif [[ ${p} == "+n" || ${p} == "++no_color" ]] ; then do_color=none fi else - if [[ $grab_next == "defines" ]] ; then - if [[ $defines == "" ]] ; then - defines=$p + if [[ ${grab_next} == "defines" ]] ; then + if [[ ${defines} == "" ]] ; then + defines=${p} else - defines="$defines $p" + defines="${defines} ${p}" fi - elif [[ $grab_next == "modes" ]] ; then - if [[ $modes == "" ]] ; then - modes=$p + elif [[ ${grab_next} == "modes" ]] ; then + if [[ ${modes} == "" ]] ; then + modes=${p} else - modes="$modes $p" + modes="${modes} ${p}" fi - elif [[ $grab_next == "process" ]] ; then - process="$p" - elif [[ $grab_next == "file_settings" ]] ; then - file_settings="$p" - elif [[ $grab_next == "path_build" ]] ; then - path_build=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_build" ]] ; then - path_source_build=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_codes" ]] ; then - path_source_codes=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_common" ]] ; then - path_source_common=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_data" ]] ; then - path_source_data=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_documents" ]] ; then - path_source_documents=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_licenses" ]] ; then - path_source_licenses=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_source_settings" ]] ; then - path_source_settings=$(process_pre_path_fix $p) - elif [[ $grab_next == "path_work" ]] ; then - path_work=$(process_pre_path_fix $p) + elif [[ ${grab_next} == "process" ]] ; then + process="${p}" + elif [[ ${grab_next} == "file_settings" ]] ; then + file_settings="${p}" + elif [[ ${grab_next} == "path_build" ]] ; then + path_build=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_build" ]] ; then + path_source_build=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_codes" ]] ; then + path_source_codes=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_common" ]] ; then + path_source_common=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_data" ]] ; then + path_source_data=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_documents" ]] ; then + path_source_documents=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_licenses" ]] ; then + path_source_licenses=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_source_settings" ]] ; then + path_source_settings=$(process_pre_path_fix ${p}) + elif [[ ${grab_next} == "path_work" ]] ; then + path_work=$(process_pre_path_fix ${p}) fi grab_next= @@ -167,14 +168,14 @@ process_pre_main() { p= fi - if [[ $do_color == "light" ]] ; then + if [[ ${do_color} == "light" ]] ; then c_error="\\033[1;31m" c_warning="\\033[0;31m" c_title="\\033[1;34m" c_highlight="\\033[0;34m" c_notice="\\033[0;01m" c_important="\\033[0;35m" - elif [[ $do_color == "none" ]] ; then + elif [[ ${do_color} == "none" ]] ; then c_reset= c_title= c_error= @@ -187,64 +188,65 @@ process_pre_main() { fi # update paths based on parameters. - path_data_build="${path_data}build$path_directory_separator" - - path_sources_bash="${path_sources}bash$path_directory_separator" - path_sources_c="${path_sources}c$path_directory_separator" - path_sources_cpp="${path_sources}c++$path_directory_separator" - - path_build_documents="${path_build}documents$path_directory_separator" - path_build_includes="${path_build}includes$path_directory_separator" - path_build_libraries="${path_build}libraries$path_directory_separator" - path_build_libraries_script="${path_build_libraries}script$path_directory_separator" - path_build_libraries_shared="${path_build_libraries}shared$path_directory_separator" - path_build_libraries_static="${path_build_libraries}static$path_directory_separator" - path_build_objects="${path_build}objects$path_directory_separator" - path_build_process="${path_build}process$path_directory_separator" - path_build_programs="${path_build}programs$path_directory_separator" - path_build_programs_script="${path_build_programs}script$path_directory_separator" - path_build_programs_shared="${path_build_programs}shared$path_directory_separator" - path_build_programs_static="${path_build_programs}static$path_directory_separator" - path_build_settings="${path_build}settings$path_directory_separator" - - if [[ $path_work != "" ]] ; then - path_work_includes="${path_work}includes$path_directory_separator" - path_work_libraries="${path_work_libraries}libraries$path_directory_separator" - path_work_libraries_script="${path_work_libraries_script}script$path_directory_separator" - path_work_libraries_shared="${path_work_libraries_shared}shared$path_directory_separator" - path_work_libraries_static="${path_work_libraries_static}static$path_directory_separator" - path_work_programs="${path_work_programs}programs$path_directory_separator" - path_work_programs_script="${path_work_programs_script}script$path_directory_separator" - path_work_programs_shared="${path_work_programs_shared}shared$path_directory_separator" - path_work_programs_static="${path_work_programs_static}static$path_directory_separator" + path_data_build="${path_data}build${path_directory_separator}" + + path_sources_bash="${path_sources}bash${path_directory_separator}" + path_sources_c="${path_sources}c${path_directory_separator}" + path_sources_cpp="${path_sources}c++${path_directory_separator}" + + path_build_documents="${path_build}documents${path_directory_separator}" + path_build_includes="${path_build}includes${path_directory_separator}" + path_build_libraries="${path_build}libraries${path_directory_separator}" + path_build_libraries_script="${path_build_libraries}script${path_directory_separator}" + path_build_libraries_shared="${path_build_libraries}shared${path_directory_separator}" + path_build_libraries_static="${path_build_libraries}static${path_directory_separator}" + path_build_objects="${path_build}objects${path_directory_separator}" + path_build_process="${path_build}process${path_directory_separator}" + path_build_programs="${path_build}programs${path_directory_separator}" + path_build_programs_script="${path_build_programs}script${path_directory_separator}" + path_build_programs_shared="${path_build_programs}shared${path_directory_separator}" + path_build_programs_static="${path_build_programs}static${path_directory_separator}" + path_build_settings="${path_build}settings${path_directory_separator}" + + if [[ ${path_work} != "" ]] ; then + path_work_includes="${path_work}includes${path_directory_separator}" + path_work_libraries="${path_work_libraries}libraries${path_directory_separator}" + path_work_libraries_script="${path_work_libraries_script}script${path_directory_separator}" + path_work_libraries_shared="${path_work_libraries_shared}shared${path_directory_separator}" + path_work_libraries_static="${path_work_libraries_static}static${path_directory_separator}" + path_work_programs="${path_work_programs}programs${path_directory_separator}" + path_work_programs_script="${path_work_programs_script}script${path_directory_separator}" + path_work_programs_shared="${path_work_programs_shared}shared${path_directory_separator}" + path_work_programs_static="${path_work_programs_static}static${path_directory_separator}" fi file_data_build_dependencies="${path_data_build}dependencies" file_data_build_settings="${path_data_build}settings" file_documents_readme="${path_documents}readme" - if [[ $verbosity != "quiet" && $verbosity != "error" ]] ; then + if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then echo - echo -e "${c_title}Processing Operation: $c_reset$c_notice$operation$c_reset" + echo -e "${c_title}Processing Operation: ${c_reset}${c_notice}${operation}${c_reset}" - if [[ $modes != "" ]] ; then - echo -e " Modes: $c_reset$c_notice$modes$c_reset" + if [[ ${modes} != "" ]] ; then + echo -e " Modes: ${c_reset}${c_notice}${modes}${c_reset}" fi - if [[ $defines != "" ]] ; then - echo -e " Defines: $c_reset$c_notice$defines$c_reset" + if [[ ${defines} != "" ]] ; then + echo -e " Defines: ${c_reset}${c_notice}${defines}${c_reset}" fi fi - # cleanup and return. + # Clean up and return. unset process_pre_main unset process_pre_path_fix + return 0 } process_pre_path_fix() { - echo -n $* | sed -e "s|^${path_directory_separator}${path_directory_separator}*|${path_directory_separator}|" -e "s|${path_directory_separator}*$|${path_directory_separator}|" + echo -n ${*} | sed -e "s|^${path_directory_separator}${path_directory_separator}*|${path_directory_separator}|" -e "s|${path_directory_separator}*$|${path_directory_separator}|" } -# note: "$@" is necessary to preserve quoted arguments when passing to function. +# Note: "$@" is necessary to preserve quoted arguments when passing to function. process_pre_main "$@" -- 1.8.3.1