Be more consistent about wrapping all variables in brackets.
This helps make the code more consistent and also more compatible with other interpreters like ZSH.
Don't use echo pipe syntax and instead use "<<<" redirection pipe syntax for passing variables to program calls.
The grep commands should use either `-sho` or `-shoP`.
j=
p=
- while [[ ${i} -le $# ]] ; do
+ while [[ ${i} -le ${#} ]] ; do
if [[ ${SHELL_ENGINE} == "zsh" ]] ; then
p=${(P)i}
elif [[ ${p} == "-w" || ${p} == "--work" ]] ; then
let i++
- if [[ ${i} -le $# ]] ; then
+ if [[ ${i} -le ${#} ]] ; then
path_work=${p}
fi
fi
fi
done
- if [[ $skip != "" ]] ; then
+ if [[ ${skip} != "" ]] ; then
echo "Skipping program: '${i}'."
echo
local enable_shared=
local enable_static=
- if [[ $# -gt 0 ]] ; then
- t=$#
+ if [[ ${#} -gt 0 ]] ; then
+ t=${#}
while [[ ${i} -lt ${t} ]] ; do
let i=${i}+1
elif [[ ${grab_next} == "settings_name" ]] ; then
settings_name="${p}"
elif [[ ${grab_next} == "path_build" ]] ; then
- path_build=$(echo ${p} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_build=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${p})
override_path_build="y"
elif [[ ${grab_next} == "path_data" ]] ; then
- path_data=$(echo ${p} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_data=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${p})
override_path_data="y"
elif [[ ${grab_next} == "path_sources" ]] ; then
- path_sources=$(echo ${p} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_sources=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${p})
override_path_sources="y"
elif [[ ${grab_next} == "path_work" ]] ; then
- path_work=$(echo ${p} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_work=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${p})
override_path_work="y"
fi
fi
# If the settings_name has a directory separator, then assume it is a path to the settings file.
- if [[ $(echo ${settings_name} | grep -s -o '/') == "" ]] ; then
+ if [[ $(grep -sho '/' <<< ${settings_name}) == "" ]] ; then
settings_file="${path_data}build/${settings_name}"
else
settings_file="${settings_name}"
# FSS and Featurless Make supports more flexible mode names, but for the purpose of this bootstrap script and avoiding potential problems, keep it simple.
if [[ ${modes} != "" ]] ; then
for mode in ${modes} ; do
- if [[ $(echo "${mode}" | grep -s -o "[^_[:alnum:]+-]") != "" ]] ; then
+ if [[ $(grep -sho '[^_[:alnum:]+-]' <<< ${mode}) != "" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: The mode ${c_notice}${mode}${c_error} includes invalid characters, only alphanumeric, underscore, minus, and plus are allowed.${c_reset}"
fi
# Get available modes.
if [[ ${modes_available} == "" ]] ; then
- modes_available=$(grep -s -o "^[[:space:]]*modes[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*modes\>||" -e 's|^[[:space:]]*||')
+ modes_available=$(grep -sho "^[[:space:]]*modes[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*modes\>||" -e 's|^[[:space:]]*||')
fi
# Get default modes.
- modes_default=$(grep -s -o "^[[:space:]]*modes_default[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*modes_default\>||" -e 's|^[[:space:]]*||')
+ modes_default=$(grep -sho "^[[:space:]]*modes_default[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*modes_default\>||" -e 's|^[[:space:]]*||')
# Use default modes if no mode is explicitly provided.
if [[ ${modes} == "" ]] ; then
variables[${key}]="no"
fi
else
- if [[ $(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
- value=$(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||')
+ if [[ $(grep -sho "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
+ value=$(grep -sho "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||')
variables[${key}]="${value}"
key=
if [[ ${key} != "" ]] ; then
variables[${key}]="yes"
fi
- elif [[ $(grep -s -o "^[[:space:]]*${i}\$" ${settings_file}) != "" ]] ; then
+ elif [[ $(grep -sho "^[[:space:]]*${i}\$" ${settings_file}) != "" ]] ; then
variables[${key}]=""
key=
variables[${key}]="no"
fi
else
- if [[ $(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
- value=$(grep -s -o "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||')
+ if [[ $(grep -sho "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
+ value=$(grep -sho "^[[:space:]]*${i}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}\>||" -e 's|^[[:space:]]*||')
variables[${key}]="${variables[${key}]}${value} "
key=
if [[ ${key} != "" ]] ; then
variables[${key}]="yes"
fi
- elif [[ $(grep -s -o "^[[:space:]]*${i}\$" ${settings_file}) != "" ]] ; then
+ elif [[ $(grep -sho "^[[:space:]]*${i}\$" ${settings_file}) != "" ]] ; then
variables[${key}]=""
key=
fi
else
- if [[ $(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
- value=$(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file} | sed -e "H;/${i}-${m}/h;\$!d;x" | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||')
+ if [[ $(grep -sho "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
+ value=$(grep -sho "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file} | sed -e "H;/${i}-${m}/h;\$!d;x" | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||')
variables[${key}]="${value}"
key=
if [[ ${key} != "" ]] ; then
variables[${key}]="yes"
fi
- elif [[ $(grep -s -o "^[[:space:]]*${i}-${m}\$" ${settings_file}) != "" ]] ; then
+ elif [[ $(grep -sho "^[[:space:]]*${i}-${m}\$" ${settings_file}) != "" ]] ; then
variables[${key}]=""
key=
variables[${key}]="no"
fi
else
- if [[ $(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
- value=$(grep -s -o "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||')
+ if [[ $(grep -sho "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file}) != "" ]] ; then
+ value=$(grep -sho "^[[:space:]]*${i}-${m}[[:space:]].*\$" ${settings_file} | sed -e "s|^[[:space:]]*${i}-${m}\>||" -e 's|^[[:space:]]*||')
variables[${key}]="${variables[${key}]}${value} "
key=
if [[ ${key} != "" ]] ; then
variables[${key}]="yes"
fi
- elif [[ $(grep -s -o "^[[:space:]]*${i}-${m}\$" ${settings_file}) != "" ]] ; then
+ elif [[ $(grep -sho "^[[:space:]]*${i}-${m}\$" ${settings_file}) != "" ]] ; then
variables[${key}]=""
key=
fi
sources="${path_sources_object}${path_language}${i} "
- n=$(echo $i | sed -e 's|\.[^\.]*$||')
+ n=$(sed -e 's|\.[^\.]*$||' <<< ${i})
if [[ ${verbosity} == "verbose" ]] ; then
echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_shared}${n}.o ${arguments_shared} ${arguments_include} ${libraries} ${libraries_shared} ${flags} ${flags_shared} ${flags_object} ${flags_object_shared} ${defines} ${defines_shared} ${defines_object} ${defines_object_shared} ${define_extra}
fi
sources="${path_sources_object}${path_language}${i} "
- n=$(echo $i | sed -e 's|\.[^\.]*$||')
+ n=$(sed -e 's|\.[^\.]*$||' <<< ${i})
if [[ ${verbosity} == "verbose" ]] ; then
echo ${build_compiler} ${sources} -c -o ${path_build}objects/${path_object_static}${n}.o ${arguments_static} ${arguments_include} ${libraries} ${libraries_static} ${flags} ${flags_static} ${flags_object} ${flags_object_static} ${defines} ${defines_static} ${defines_object} ${defines_object_static} ${define_extra}
fi
if [[ ${path_headers} != "" ]] ; then
- path_headers=$(echo ${path_headers} | sed -e 's|/*$|/|')
+ path_headers=$(sed -e 's|/*$|/|' <<< ${path_headers})
fi
}
fi
if [[ ${path_sources} != "" ]] ; then
- path_sources=$(echo ${path_sources} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_sources=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_sources})
fi
bootstrap_id "path_sources_object-mode"
fi
if [[ ${path_sources_object} != "" ]] ; then
- path_sources_object=$(echo ${path_sources_object} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_sources_object=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_sources_object})
fi
bootstrap_id "path_headers-mode"
fi
if [[ ${path_headers} != "" ]] ; then
- path_headers=$(echo ${path_headers} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_headers=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_headers})
fi
bootstrap_id "has_path_standard-mode"
fi
if [[ ${path_language} != "" ]] ; then
- path_language=$(echo ${path_language} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_language=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_language})
fi
fi
fi
if [[ ${path_object_library} != "" ]] ; then
- path_object_library=$(echo ${path_object_library} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_library=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_library})
fi
bootstrap_id "path_object_program-mode"
fi
if [[ ${path_object_program} != "" ]] ; then
- path_object_program=$(echo ${path_object_program} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_program=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_program})
fi
bootstrap_id "path_library_script-mode"
fi
if [[ ${path_library_script} != "" ]] ; then
- path_library_script=$(echo ${path_library_script} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_library_script=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_library_script})
fi
bootstrap_id "path_library_shared-mode"
fi
if [[ ${path_library_shared} != "" ]] ; then
- path_library_shared=$(echo ${path_library_shared} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_library_shared=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_library_shared})
fi
bootstrap_id "path_library_static-mode"
fi
if [[ ${path_library_static} != "" ]] ; then
- path_library_static=$(echo ${path_library_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_library_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_library_static})
fi
bootstrap_id "path_object_library_script-mode"
fi
if [[ ${path_object_library_script} != "" ]] ; then
- path_object_library_script=$(echo ${path_object_library_script} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_library_script=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_library_script})
fi
bootstrap_id "path_object_library_shared-mode"
fi
if [[ ${path_object_library_shared} != "" ]] ; then
- path_object_library_shared=$(echo ${path_object_library_shared} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_library_shared=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_library_shared})
fi
bootstrap_id "path_object_library_static-mode"
fi
if [[ ${path_object_library_static} != "" ]] ; then
- path_object_library_static=$(echo ${path_object_library_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_library_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_library_static})
fi
bootstrap_id "path_object_program_script-mode"
fi
if [[ ${path_object_program_script} != "" ]] ; then
- path_object_program_script=$(echo ${path_object_program_script} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_program_script=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_program_script})
fi
bootstrap_id "path_object_program_shared-mode"
fi
if [[ ${path_object_program_shared} != "" ]] ; then
- path_object_program_shared=$(echo ${path_object_program_shared} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_program_shared=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_program_shared})
fi
bootstrap_id "path_object_program_static-mode"
fi
if [[ ${path_object_program_static} != "" ]] ; then
- path_object_program_static=$(echo ${path_object_program_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_program_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_program_static})
fi
bootstrap_id "path_object_script-mode"
fi
if [[ ${path_object_script} != "" ]] ; then
- path_object_script=$(echo ${path_object_script} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_script=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_script})
fi
bootstrap_id "path_object_shared-mode"
fi
if [[ ${path_object_shared} != "" ]] ; then
- path_object_shared=$(echo ${path_object_shared} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_shared=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_shared})
fi
bootstrap_id "path_object_static-mode"
fi
if [[ ${path_object_static} != "" ]] ; then
- path_object_static=$(echo ${path_object_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_static})
fi
if [[ ${path_object_static} != "" ]] ; then
- path_object_static=$(echo ${path_object_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_object_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_object_static})
fi
bootstrap_id "path_program_script-mode"
fi
if [[ ${path_program_script} != "" ]] ; then
- path_program_script=$(echo ${path_program_script} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_program_script=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_program_script})
fi
bootstrap_id "path_program_shared-mode"
fi
if [[ ${path_program_shared} != "" ]] ; then
- path_program_shared=$(echo ${path_program_shared} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_program_shared=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_program_shared})
fi
bootstrap_id "path_program_static-mode"
fi
if [[ ${path_program_static} != "" ]] ; then
- path_program_static=$(echo ${path_program_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_program_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_program_static})
fi
if [[ ${path_program_static} != "" ]] ; then
- path_program_static=$(echo ${path_program_static} | sed -e 's|//*|/|g' -e 's|/*$|/|')
+ path_program_static=$(sed -e 's|//*|/|g' -e 's|/*$|/|' <<< ${path_program_static})
fi
}
bootstrap_operation_build_validate_sources() {
for i in ${sources_script} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_script path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_headers} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_headers path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_library} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_library path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_library_object} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_library_object path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_program_object} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_program_object path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_program} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_program path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_documentation} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_documentation path provided: '${i}'.${c_reset}"
fi
done
for i in ${sources_setting} ; do
- if [[ ${i} != "$(echo ${i} | sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||')" ]] ; then
+ if [[ ${i} != "$(sed -e 's|^//*||' -e 's|^\.\.//*||' -e 's|/*$||' <<< ${i})" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot Build, invalid build_sources_setting path provided: '${i}'.${c_reset}"
fi
main() {
local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
- local -i first="$1"
- local -i last="$2"
+ local -i first="${1}"
+ local -i last="${2}"
- while [[ $first -le $last ]] ; do
- printf "U+%04X\n" $first
+ while [[ ${first} -le ${last} ]] ; do
+ printf "U+%04X\n" ${first}
let first++
done
}
-main "$1" "$2"
+main "${1}" "${2}"
local verbose=
local verbose_common=
- if [[ $# -gt 0 ]] ; then
- t=$#
+ if [[ ${#} -gt 0 ]] ; then
+ t=${#}
while [[ ${i} -lt ${t} ]] ; do
let i=${i}+1
fi
else
if [[ ${grab_next} == "destination" ]] ; then
- destination=$(echo ${p} | sed -e 's|$|/|' -e 's|//*|/|g')
+ destination=$(sed -e 's|$|/|' -e 's|//*|/|g' <<< ${p})
elif [[ ${grab_next} == "source" ]] ; then
- source=$(echo ${p} | sed -e 's|$|/|' -e 's|//*|/|g')
+ source=$(sed -e 's|$|/|' -e 's|//*|/|g' <<< ${p})
fi
grab_next=
return 0
fi
- if [[ $(echo "$name" | grep -s -o "/") != "" || ${name} == "" ]] ; then
+ if [[ $(grep -sho "/" <<< ${name}) != "" || ${name} == "" ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
if [[ ${name} == "" ]] ; then
echo -e "${c_error}ERROR: No ${c_notice}name${c_error} parameter has been provided or is empty.${c_reset}"
find -L ${source} -not -path '*/\.*' \( -name '*.h' \) | ctags -n --fields=EfiklsZSt --extras=-f --c-kinds=+p -L - -f "${file}" --tag-relative=never --language-force=c
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: The ${c_notice}ctags${c_error} process failed.${c_reset}"
fi
sed -i -e "s|${source}||g" "${file}"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Failed to strip the full path from the ${c_notice}${file}${c_error} file.${c_reset}"
fi
local IFS=$' \t\n' # Prevent IFS exploits by overriding with a local scope.
local file_input="codes.txt"
- local mode=$1
+ local mode=${1}
local code=
local sequence=
local block=
local u3=
local -i i=0
- if [[ $mode == "" ]] ; then
+ if [[ ${mode} == "" ]] ; then
mode=source
- elif [[ ! ($mode == "source" || $mode == "test") ]] ; then
+ elif [[ ! (${mode} == "source" || ${mode} == "test") ]] ; then
- # return on invalid parameter.
+ # Return on invalid parameter.
return 1
fi
- for code in $(cat $file_input) ; do
+ for code in $(cat ${file_input}) ; do
process
- if [[ "$previous" == "" || "$block" == "$previous" ]] ; then
- if [[ $i -eq 0 ]] ; then
- s0=$sequence
- u0=$code
+ if [[ "${previous}" == "" || "${block}" == "${previous}" ]] ; then
+ if [[ ${i} -eq 0 ]] ; then
+ s0=${sequence}
+ u0=${code}
let i++
- elif [[ $i -eq 1 ]] ; then
- s1=$sequence
- u1=$code
+ elif [[ ${i} -eq 1 ]] ; then
+ s1=${sequence}
+ u1=${code}
let i++
- elif [[ $i -eq 2 ]] ; then
- s2=$sequence
- u2=$code
+ elif [[ ${i} -eq 2 ]] ; then
+ s2=${sequence}
+ u2=${code}
let i++
else
- s3=$sequence
- u3=$code
+ s3=${sequence}
+ u3=${code}
- generate "$block"
+ generate "${block}"
s0=
s1=
let i=0
fi
else
- if [[ $i -gt 0 ]] ; then
- generate "$previous"
+ if [[ ${i} -gt 0 ]] ; then
+ generate "${previous}"
fi
- s0=$sequence
+ s0=${sequence}
s1=
s2=
s3=
- u0=$code
+ u0=${code}
u1=
u2=
u3=
let i=1
fi
- previous="$block"
+ previous="${block}"
done
- if [[ $s0 != "" ]] ; then
- generate "$previous"
+ if [[ ${s0} != "" ]] ; then
+ generate "${previous}"
fi
}
process() {
- local utf8=$(unicode --color=0 $code | grep -o "^UTF-8:.*UTF-16BE:" | sed -e 's|UTF-8:||' -e 's|UTF-16BE:||' | sed -e 's| ||g')
+ local utf8=$(unicode --color=0 ${code} | grep -sho "^UTF-8:.*UTF-16BE:" | sed -e 's|UTF-8:||' -e 's|UTF-16BE:||' | sed -e 's| ||g')
- block=$(unicode --color=0 $code | grep -o "^Unicode block: .*$" | sed -e 's|Unicode block:.*; ||')
+ block=$(unicode --color=0 ${code} | grep -sho "^Unicode block: .*$" | sed -e 's|Unicode block:.*; ||')
- if [[ $mode == "source" ]] ; then
- sequence="0x$utf8"
+ if [[ ${mode} == "source" ]] ; then
+ sequence="0x${utf8}"
- if [[ $(echo -n "$utf8" | wc -c) -eq 2 ]] ; then
+ if [[ $(wc -c <<< ${utf8}) -eq 2 ]] ; then
sequence="${sequence}000000"
- elif [[ $(echo -n "$utf8" | wc -c) -eq 4 ]] ; then
+ elif [[ $(wc -c <<< ${utf8}) -eq 4 ]] ; then
sequence="${sequence}0000"
- elif [[ $(echo -n "$utf8" | wc -c) -eq 6 ]] ; then
+ elif [[ $(wc -c <<< ${utf8}) -eq 6 ]] ; then
sequence="${sequence}00"
fi
- elif [[ $mode == "test" ]] ; then
- sequence="$utf8"
+ elif [[ ${mode} == "test" ]] ; then
+ sequence="${utf8}"
fi
}
generate() {
- if [[ $mode == "source" ]] ; then
- generate_source "$1"
- elif [[ $mode == "test" ]] ; then
- generate_test "$1"
+ if [[ ${mode} == "source" ]] ; then
+ generate_source "${1}"
+ elif [[ ${mode} == "test" ]] ; then
+ generate_test "${1}"
fi
}
generate_source() {
local comment=
local condition=
- local block="$1"
+ local block="${1}"
- if [[ $u3 == "" ]] ; then
- if [[ $u2 == "" ]] ; then
- if [[ $u1 == "" ]] ; then
- comment="$u0"
- condition="character == $s0"
+ if [[ ${u3} == "" ]] ; then
+ if [[ ${u2} == "" ]] ; then
+ if [[ ${u1} == "" ]] ; then
+ comment="${u0}"
+ condition="character == ${s0}"
else
- comment="$u0, $u1"
- condition="character == $s0 || character == $s1"
+ comment="${u0}, ${u1}"
+ condition="character == ${s0} || character == ${s1}"
fi
else
- comment="$u0, $u1, $u2"
- condition="character == $s0 || character == $s1 || character == $s2"
+ comment="${u0}, ${u1}, ${u2}"
+ condition="character == ${s0} || character == ${s1} || character == ${s2}"
fi
else
- comment="$u0, $u1, $u2, $u3"
- condition="character == $s0 || character == $s1 || character == $s2 || character == $s3"
+ comment="${u0}, ${u1}, ${u2}, ${u3}"
+ condition="character == ${s0} || character == ${s1} || character == ${s2} || character == ${s3}"
fi
echo
- echo "// $block: $comment."
- echo "if ($condition) {"
+ echo "// ${block}: ${comment}."
+ echo "if (${condition}) {"
echo " return F_true;"
echo "}"
}
generate_test() {
- if [[ $s0 != "" ]] ; then
- printf "%llu\n" $((16#$s0))
+ if [[ ${s0} != "" ]] ; then
+ printf "%llu\n" $((16#${s0}))
fi
- if [[ $s1 != "" ]] ; then
- printf "%llu\n" $((16#$s1))
+ if [[ ${s1} != "" ]] ; then
+ printf "%llu\n" $((16#${s1}))
fi
- if [[ $s2 != "" ]] ; then
- printf "%llu\n" $((16#$s2))
+ if [[ ${s2} != "" ]] ; then
+ printf "%llu\n" $((16#${s2}))
fi
- if [[ $s3 != "" ]] ; then
- printf "%llu\n" $((16#$s3))
+ if [[ ${s3} != "" ]] ; then
+ printf "%llu\n" $((16#${s3}))
fi
}
-main "$1"
+main "${1}"
local enable_static_libraries="yes"
local enable_includes="yes"
- if [[ $# -gt 0 ]] ; then
- t=$#
+ if [[ ${#} -gt 0 ]] ; then
+ t=${#}
while [[ ${i} -lt ${t} ]] ; do
let i=${i}+1
fi
else
if [[ ${grab_next} == "path_build" ]] ; then
- path_build=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_build=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "prefix" ]] ; then
- destination_prefix=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_prefix=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "bindir" ]] ; then
- destination_programs=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_programs=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "docdir" ]] ; then
- destination_documentation=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_documentation=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "etcdir" ]] ; then
- destination_settings=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_settings=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "includedir" ]] ; then
- destination_includes=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_includes=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "libdir" ]] ; then
- destination_libraries=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_libraries=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "work" ]] ; then
- work=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ work=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "destination_libraries_static" ]] ; then
- destination_libraries_static=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_libraries_static=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "destination_libraries_shared" ]] ; then
- destination_libraries_shared=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_libraries_shared=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "destination_programs_static" ]] ; then
- destination_programs_static=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_programs_static=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "destination_programs_shared" ]] ; then
- destination_programs_shared=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ destination_programs_shared=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
fi
grab_next=
fi
if [[ ${destination_prefix} != "" ]] ; then
- if [[ $(echo ${destination_documentation} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_documentation}) == "" ]] ; then
destination_documentation="${destination_prefix}${destination_documentation}"
fi
- if [[ $(echo ${destination_programs} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_programs}) == "" ]] ; then
destination_programs="${destination_prefix}${destination_programs}"
fi
- if [[ $(echo ${destination_includes} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_includes}) == "" ]] ; then
destination_includes="${destination_prefix}${destination_includes}"
fi
- if [[ $(echo ${destination_libraries} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_libraries}) == "" ]] ; then
destination_libraries="${destination_prefix}${destination_libraries}"
fi
- if [[ $(echo ${destination_settings} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_settings}) == "" ]] ; then
destination_settings="${destination_prefix}${destination_settings}"
fi
fi
if [[ ${destination_libraries_static} != "" ]] ; then
- if [[ $(echo ${destination_libraries_static} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_libraries_static}) == "" ]] ; then
destination_libraries_static=${destination_libraries}${destination_libraries_static}
fi
else
fi
if [[ ${destination_libraries_shared} != "" ]] ; then
- if [[ $(echo ${destination_libraries_shared} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_libraries_shared}) == "" ]] ; then
destination_libraries_shared=${destination_libraries}${destination_libraries_shared}
fi
else
fi
if [[ ${destination_programs_static} != "" ]] ; then
- if [[ $(echo ${destination_programs_static} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_programs_static}) == "" ]] ; then
destination_programs_static=${destination_programs}${destination_programs_static}
fi
else
fi
if [[ ${destination_programs_shared} != "" ]] ; then
- if [[ $(echo ${destination_programs_shared} | grep -o '^/') == "" ]] ; then
+ if [[ $(grep -sho '^/' <<< ${destination_programs_shared}) == "" ]] ; then
destination_programs_shared=${destination_programs}${destination_programs_shared}
fi
else
if [[ ${failure} -eq 0 && -d ${path_build}${path_includes} && ${enable_includes} == "yes" ]] ; then
for i in ${path_build}${path_includes}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_includes}||")
+ file=$(sed -e "s|^${path_build}${path_includes}||" <<< ${i})
break
done
if [[ -d ${path_build}${path_libraries}${path_static} && ${enable_static_libraries} == "yes" ]] ; then
for i in ${path_build}${path_libraries}${path_static}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_libraries}${path_static}||")
+ file=$(sed -e "s|^${path_build}${path_libraries}${path_static}||" <<< ${i})
break
done
if [[ ${failure} -eq 0 && -d ${path_build}${path_libraries}${path_shared} && ${enable_shared_libraries} == "yes" ]] ; then
for i in ${path_build}${path_libraries}${path_shared}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_libraries}${path_shared}||")
+ file=$(sed -e "s|^${path_build}${path_libraries}${path_shared}||" <<< ${i})
break
done
if [[ -d ${path_build}${path_programs}${path_static} && ${enable_static_programs} == "yes" ]] ; then
for i in ${path_build}${path_programs}${path_static}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_programs}${path_static}||")
+ file=$(sed -e "s|^${path_build}${path_programs}${path_static}||" <<< ${i})
break
done
if [[ ${failure} -eq 0 && -d ${path_build}${path_programs}${path_shared} && ${enable_shared_programs} == "yes" ]] ; then
for i in ${path_build}${path_programs}${path_shared}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_programs}${path_shared}||")
+ file=$(sed -e "s|^${path_build}${path_programs}${path_shared}||" <<< ${i})
break
done
if [[ ${failure} -eq 0 && -d ${path_build}${path_settings} && ${enable_settings} == "yes" ]] ; then
for i in ${path_build}${path_settings}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_settings}||")
+ file=$(sed -e "s|^${path_build}${path_settings}||" <<< ${i})
break
done
if [[ ${failure} -eq 0 && -d ${path_build}${path_documentation} && ${enable_documentation} == "yes" ]] ; then
for i in ${path_build}${path_documentation}* ; do
- file=$(echo ${i} | sed -e "s|^${path_build}${path_documentation}||")
+ file=$(sed -e "s|^${path_build}${path_documentation}||" <<< ${i})
break
done
local public_name="Simple FLL Project Package Script"
local system_name=package
- local called_name=$(basename $0)
+ local called_name=$(basename ${0})
local version=0.7.2
local grab_next=
local verbose_common=
local result=
- if [[ $# -gt 0 ]] ; then
- t=$#
+ if [[ ${#} -gt 0 ]] ; then
+ t=${#}
while [[ ${i} -lt ${t} ]] ; do
let i=${i}+1
verbose="+D"
verbose_common="-v"
elif [[ ${p} == "+v" || ${p} == "++version" ]] ; then
- echo $version
+ echo ${version}
return 0
elif [[ ${p} == "-b" || ${p} == "--build" ]] ; then
grab_next=path_build
fi
else
if [[ ${grab_next} == "path_build" ]] ; then
- path_build=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_build=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "path_destination" ]] ; then
- path_destination=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_destination=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "path_sources" ]] ; then
- path_sources=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_sources=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
elif [[ ${grab_next} == "stand_alone" ]] ; then
mode_stand_alone="${mode_stand_alone}${p} "
elif [[ ${grab_next} == "prepend" ]] ; then
# Provide a bare minimal sanitizer that probably doesn't catch everything that it ideally should.
- prepend=$(echo ${p} | sed -e 's|[\!~\`@#$%^&*();:><?/"\\]||g' -e 's@|@@g' -e "s|'||g" -e "s|\s*||g")
+ prepend=$(sed -e 's|[\!~\`@#$%^&*( <<< ${p});:><?/"\\]||g' -e 's@|@@g' -e "s|'||g" -e "s|\s*||g")
fi
grab_next=
for i in build/stand_alone/*.settings ; do
- mode_stand_alone="${mode_stand_alone}$(echo ${i} | sed -e 's|build/stand_alone/||' -e 's|\.settings$||') "
+ mode_stand_alone="${mode_stand_alone}$(sed -e 's|build/stand_alone/||' -e 's|\.settings$||' <<< ${i}) "
done
fi
fi
package_handle_colors() {
- 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=
for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ${path_sources}level_3/* ; do
- name="$(echo ${directory} | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||" -e "s|${path_sources}level_3/||")"
+ name="$(sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||" -e "s|${path_sources}level_3/||" <<< ${directory})"
- level_current="$(echo ${directory} | grep -o '\<level_[[:digit:]]/' | sed -e 's|level_||' -e 's|/$||')"
+ level_current="$(grep -sho '\<level_[[:digit:]]/' | sed -e 's|level_||' -e 's|/$||' <<< ${directory})"
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
echo
fi
# Additional dependency files are only supported in level_3.
- if [[ $(echo "${directory}" | grep -o "^${path_sources}level_3/") != "" ]] ; then
+ if [[ $(grep -sho "^${path_sources}level_3/" <<< ${directory}) != "" ]] ; then
dependency_files="yes"
# When the files don't exist bash treats the pattern as a literal file.
if [[ ! -f ${dependency_file} ]] ; then
- if [[ $dependency_files == "yes" && "${directory}/data/build/dependencies" != ${dependency_file} ]] ; then
+ if [[ ${dependency_files} == "yes" && "${directory}/data/build/dependencies" != ${dependency_file} ]] ; then
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
echo -e "${c_warning}WARNING: The dependency file ${c_notice}${dependency_file}${c_warning} is not found.${c_reset}"
fi
- elif [[ $dependency_files == "no" && "${directory}/data/build/dependencies.*" != ${dependency_file} ]] ; then
+ elif [[ ${dependency_files} == "no" && "${directory}/data/build/dependencies.*" != ${dependency_file} ]] ; then
if [[ ${verbosity} != "quiet" ]] ; then
echo -e "${c_error}ERROR: Cannot build dependencies, failed to find ${c_notice}${dependency_file}${c_error} file(s).${c_reset}"
fi
if [[ ${dependency_file} == "${directory}/data/build/dependencies" ]] ; then
dependency_suffix=
else
- dependency_suffix=$(echo ${dependency_file} | sed -e "s|^${directory}/data/build/dependencies||")
+ dependency_suffix=$(sed -e "s|^${directory}/data/build/dependencies||" <<< ${dependency_file})
fi
if [[ ! -f ${directory}/data/build/settings${dependency_suffix} ]] ; then
dependencies=$(cat ${dependency_file} | sed -e "/^\s*#/d" -e "s|#\.*$||")
- if [[ $(echo "$dependencies" | grep -o "\<f_thread\>") != "" ]] ; then
+ if [[ $(grep -sho "\<f_thread\>" <<< ${dependencies}) != "" ]] ; then
has_thread="yes"
fi
- for dependency in $dependencies ; do
+ for dependency in ${dependencies} ; do
- if [[ $(echo "${dependency}" | grep -o "^f_") != "" ]] ; then
+ if [[ $(grep -sho "^f_" <<< ${dependency}) != "" ]] ; then
level=level_0
- elif [[ $(echo "${dependency}" | grep -o "^fl_") != "" ]] ; then
+ elif [[ $(grep -sho "^fl_" <<< ${dependency}) != "" ]] ; then
level=level_1
- elif [[ $(echo "${dependency}" | grep -o "^fll_") != "" ]] ; then
+ elif [[ $(grep -sho "^fll_" <<< ${dependency}) != "" ]] ; then
level=level_2
else
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
sub_dependencies=$(cat ${path_sources}${level}/${dependency}/data/build/dependencies | sed -e "/^\s*#/d" -e "s|#\.*$||")
fi
- for sub_dependency in $sub_dependencies ; do
+ for sub_dependency in ${sub_dependencies} ; do
- if [[ $(echo "${sub_dependency}" | grep -o "^f_") != "" ]] ; then
+ if [[ $(grep -sho "^f_" <<< ${sub_dependency}) != "" ]] ; then
sub_level=level_0
- elif [[ $(echo "${sub_dependency}" | grep -o "^fl_") != "" ]] ; then
+ elif [[ $(grep -sho "^fl_" <<< ${sub_dependency}) != "" ]] ; then
sub_level=level_1
else
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
sub_sub_dependencies=$(cat ${path_sources}${sub_level}/${sub_dependency}/data/build/dependencies | sed -e "/^\s*#/d" -e "s|#\.*$||")
fi
- for sub_sub_dependency in $sub_sub_dependencies ; do
+ for sub_sub_dependency in ${sub_sub_dependencies} ; do
- if [[ $(echo "${sub_sub_dependency}" | grep -o "^f_") != "" ]] ; then
+ if [[ $(grep -sho "^f_" <<< ${sub_sub_dependency}) != "" ]] ; then
sub_sub_level=level_0
else
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
break;
fi
- dependencies_individual=$(echo "${dependencies_individual}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|[[:space:]][[:space:]]*$| |')
+ dependencies_individual=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|[[:space:]][[:space:]]*$| |' <<< ${dependencies_individual})
if [[ ${dependencies_individual} != "" ]] ; then
if [[ ${verbosity} == "verbose" ]] ; then
echo -e " ${dependencies_individual}"
}
package_dependencies_individual_append() {
- local level="$1"
- local dependency="$2"
+ local level="${1}"
+ local dependency="${2}"
local settings=
local libraries=
return 1
fi
- libraries=$(grep -o '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||')
+ libraries=$(grep -sho '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||')
- if [[ $libraries != "" ]] ; then
- if [[ $(echo -n ${dependencies_individual} | grep -o "\-l${dependency}\>") == "" ]] ; then
+ if [[ ${libraries} != "" ]] ; then
+ if [[ $(grep -sho "\-l${dependency}\>" <<< ${dependencies_individual}) == "" ]] ; then
if [[ "$(type -p sort)" != "" ]] ; then
if [[ ${level} == "level_0" ]] ; then
}
package_dependencies_level_update() {
- local level="$1"
- local level_libraries="$2"
+ local level="${1}"
+ local level_libraries="${2}"
local level_sources_library=
local level_sources_headers=
local level_sources_library_threaded=
for directory in ${path_sources}${level}/* ; do
- name="$(echo ${directory} | sed -e "s|${path_sources}${level}/||")"
+ name="$(sed -e "s|${path_sources}${level}/||" <<< ${directory})"
settings=${directory}/data/build/settings
if [[ ! -f ${settings} ]] ; then
return 1
fi
- libraries=$(grep -o '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||')
+ libraries=$(grep -sho '^\s*build_sources_library\s.*$' ${settings} | sed -e 's|^\s*build_sources_library\>||' -e 's|^\s*||' -e 's|\s*$||')
- for library in $libraries ; do
+ for library in ${libraries} ; do
if [[ ${name} == "f_thread" ]] ; then
- level_sources_library_threaded="${level_sources_library_threaded} $library"
+ level_sources_library_threaded="${level_sources_library_threaded} ${library}"
monolithic_libraries_threaded="${monolithic_libraries_threaded} ${level}/${library}"
else
- level_sources_library="${level_sources_library} $library"
+ level_sources_library="${level_sources_library} ${library}"
monolithic_libraries="${monolithic_libraries} ${level}/${library}"
fi
done
- headers=$(grep -o '^\s*build_sources_headers\s.*$' ${settings} | sed -e 's|^\s*build_sources_headers\>||' -e 's|^\s*||' -e 's|\s*$||')
+ headers=$(grep -sho '^\s*build_sources_headers\s.*$' ${settings} | sed -e 's|^\s*build_sources_headers\>||' -e 's|^\s*||' -e 's|\s*$||')
- for header in $headers ; do
+ for header in ${headers} ; do
if [[ ${name} == "f_thread" ]] ; then
- level_sources_headers_threaded="${level_sources_headers_threaded} $header"
+ level_sources_headers_threaded="${level_sources_headers_threaded} ${header}"
monolithic_headers_threaded="${monolithic_headers_threaded} ${level}/${header}"
else
- level_sources_headers="${level_sources_headers} $header"
+ level_sources_headers="${level_sources_headers} ${header}"
monolithic_headers="${monolithic_headers} ${level}/${header}"
fi
done
return 1
fi
- level_sources_library=$(echo "${level_sources_library}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_sources_library=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${level_sources_library})
if [[ ${level_sources_library} != "" ]] ; then
echo " ${level_sources_library}"
level_sources_library=" ${level_sources_library}"
return 1
fi
- level_sources_headers=$(echo "${level_sources_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_sources_headers=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${level_sources_headers})
if [[ ${level_sources_headers} != "" ]] ; then
echo " ${level_sources_headers}"
level_sources_headers=" ${level_sources_headers}"
fi
if [[ ${level} == "level_0" ]] ; then
- level_0_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_0_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_0_libraries=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries})
+ level_0_headers=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers})
- level_0_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_0_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_0_libraries_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries_threaded})
+ level_0_headers_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers_threaded})
elif [[ ${level} == "level_1" ]] ; then
- level_1_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_1_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_1_libraries=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries})
+ level_1_headers=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers})
- level_1_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_1_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_1_libraries_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries_threaded})
+ level_1_headers_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers_threaded})
elif [[ ${level} == "level_2" ]] ; then
- level_2_libraries=$(echo "${monolithic_libraries}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_2_headers=$(echo "${monolithic_headers}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_2_libraries=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries})
+ level_2_headers=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers})
- level_2_libraries_threaded=$(echo "${monolithic_libraries_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
- level_2_headers_threaded=$(echo "${monolithic_headers_threaded}" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||')
+ level_2_libraries_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_libraries_threaded})
+ level_2_headers_threaded=$(sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' <<< ${monolithic_headers_threaded})
fi
return 0
local language=
- if [[ $(grep -soP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
language="c"
- elif [[ $(grep -soP '^\s*\bbuild_language\b\s+c\+\+\s*$' ${package}data/build/settings) != "" ]] ; then
+ elif [[ $(grep -shoP '^\s*\bbuild_language\b\s+c\+\+\s*$' ${package}data/build/settings) != "" ]] ; then
language="c++"
else
return 0
fi
if [[ ${language} == "c" && ! -f ${package}sources/c/config.c ]] ; then
- if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then
sed -i -E -e "s|^\s*\bbuild_sources_program\s+|&config.c |" ${package}data/build/settings
if [[ ${?} -ne 0 ]] ; then
return ${failure}
fi
- elif [[ $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ elif [[ $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
sed -i -E -e "s|^\s*\bbuild_sources_library\s+|&config.c |" ${package}data/build/settings
if [[ ${?} -ne 0 ]] ; then
fi
fi
- if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
echo > ${package}sources/c/config.c &&
echo "#include \"config.h\"" >> ${package}sources/c/config.c
fi
fi
elif [[ ${language} == "c++" && ! -f ${package}sources/c/config.cpp ]] ; then
- if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" ]] ; then
sed -i -E -e "s|^\s*\bbuild_sources_program\s+|&config.cpp |" ${package}data/build/settings
if [[ ${?} -ne 0 ]] ; then
return ${failure}
fi
- elif [[ $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ elif [[ $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
sed -i -E -e "s|^\s*\bbuild_sources_library\s+|&config.cpp |" ${package}data/build/settings
if [[ ${?} -ne 0 ]] ; then
fi
fi
- if [[ $(grep -soP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -soP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_sources_program\b\s+\S' ${package}data/build/settings) != "" || $(grep -shoP '^\s*\bbuild_sources_library\b\s+\S' ${package}data/build/settings) != "" ]] ; then
echo > ${package}sources/c++/config.cpp &&
echo "#include \"config.h\"" >> ${package}sources/c++/config.cpp
fi
if [[ ( ${language} == "c" && ! -f ${package}sources/c/config.h ) || ( ${language} == "c++" && ! -f ${package}sources/c++/config.h ) ]] ; then
- if [[ $(grep -soP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
+ if [[ $(grep -shoP '^\s*\bbuild_language\b\s+c\s*$' ${package}data/build/settings) != "" ]] ; then
echo > ${package}sources/c/config.h
if [[ ${?} -ne 0 ]] ; then
for directory in ${path_sources}level_0/* ${path_sources}level_1/* ${path_sources}level_2/* ; do
- name="$(echo ${directory} | sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||")"
+ name="$(sed -e "s|${path_sources}level_0/||" -e "s|${path_sources}level_1/||" -e "s|${path_sources}level_2/||" <<< ${directory})"
package="${path_destination}individual/${prepend}${name}-${version}/"
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
for directory in ${path_sources}level_3/* ; do
- name="$(echo ${directory} | sed -e "s|${path_sources}level_3/||")"
+ name="$(sed -e "s|${path_sources}level_3/||" <<< ${directory})"
package="${path_destination}program/${prepend}${name}-${version}/"
if [[ ${verbosity} != "quiet" && ${verbosity} != "error" ]] ; then
# Copy all sources into a named sub-directory.
for path_ in ${package}sources/* ; do
- path_name="$(basename $path_)"
+ path_name="$(basename ${path_})"
for path_sub in ${package}sources/${path_name}/* ; do
path_name_sub="$(basename ${path_sub})"
# Do not attempt copying into self.
- if [[ $path_name_sub == "program" ]] ; then
+ if [[ ${path_name_sub} == "program" ]] ; then
continue
fi
fi
if [[ -f ${package}data/build/dependencies ]] ; then
- packages=$(grep -soP '^\s*[^\s]+' ${package}data/build/dependencies | sed -e 's|^[[:space:]]*||g')
+ packages=$(grep -shoP '^\s*[^\s]+' ${package}data/build/dependencies | sed -e 's|^[[:space:]]*||g')
if [[ ${packages} != "" ]] ; then
for package_sub in ${packages} ; do
local projects_no_tests="f_type"
local programs="fss_read"
- if [[ $# -gt 0 ]] ; then
- t=$#
+ if [[ ${#} -gt 0 ]] ; then
+ t=${#}
while [[ ${i} -lt ${t} ]] ; do
if [[ ${grab_next} == "build_compiler" ]] ; then
build_compiler=${p}
elif [[ ${grab_next} == "path_scripts" ]] ; then
- path_scripts=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_scripts=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
path_scripts_package=${path_scripts}package.sh
elif [[ ${grab_next} == "path_test" ]] ; then
- path_test=$(echo ${p} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_test=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${p})
path_test_package=${path_test}package/
path_test_package_individual=${path_test_package}individual/
path_test_package_program=${path_test_package}program/
if [[ ${failure} -eq 0 ]] ; then
test_operate
- let failure=$?
+ let failure=${?}
fi
test_cleanup
if [[ ${failure} -eq 0 ]] ; then
if [[ ! -f ${path_test_package_individual}${project}-${version}/data/build/testfile ]] ; then
- if [[ $(echo ${projects_no_tests} | grep -o "\<${project}\>") == "" ]] ; then
+ if [[ $(grep -sho "\<${project}\>" <<< ${projects_no_tests}) == "" ]] ; then
if [[ ${verbosity} == "verbose" || ${verbosity} == "debug" ]] ; then
echo -e "${c_warning}WARNING: Project '${c_notice}${project}${c_warning}' does not have a testfile.${c_reset}"
fi
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.
-process_post_main "$@"
+# Note: "${@}" is necessary to preserve quoted arguments when passing to function.
+process_post_main "${@}"
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.
-process_pre_main "$@"
+# Note: "${@}" is necessary to preserve quoted arguments when passing to function.
+process_pre_main "${@}"
local test_current=
local test_set="${1}"
- standard=$(echo -n ${test_set} | sed -e 's|^.*-||g')
+ standard=$(sed -e 's|^.*-||g' <<< ${test_set})
- if [[ $standard == "" ]] ; then
+ if [[ ${standard} == "" ]] ; then
echo "ERROR: No standard specified."
return 1
fi
- if [[ $file_source == "" ]] ; then
+ if [[ ${file_source} == "" ]] ; then
echo "ERROR: No source file specified."
return 1
fi
- if [[ $path_destination == "" ]] ; then
+ if [[ ${path_destination} == "" ]] ; then
echo "ERROR: No destination path specified."
return 1
fi
- file_source=$(echo ${file_source} | sed -e 's|^//*|/|' -e 's|//*|/|' -e 's|/*$||')
- path_destination=$(echo ${path_destination} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ file_source=$(sed -e 's|^//*|/|' -e 's|//*|/|' -e 's|/*$||' <<< ${file_source})
+ path_destination=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_destination})
if [[ ! -f ${file_source} ]] ; then
echo "ERROR: The source file '${file_source}' either does not exist or is not a file."
return 1
fi
- test_base=$(echo ${file_source} | sed -e 's|.*/||g' -e 's|\..*$||')
+ test_base=$(sed -e 's|.*/||g' -e 's|\..*$||' <<< ${file_source})
test_current="${path_destination}${test_base}-"
if [[ ${test_set} == "0000" ]] ; then
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_0001() {
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_0002() {
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_0003() {
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_0008() {
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_0008_special_cases() {
generate_operate_run_0008 +n -oc -l 1 -d 1 -n depth_1_set_3_same_name -a 2 -d 3 -a 0 ${file_source} > ${test_current}object_content-line_1-depth_1-name_depth_1_set_3_same_name-at_2-depth_3-at_0.expect &&
generate_operate_run_0008 +n -oc -l 1 -d 2 -n depth_2_same_across_sets -a 2 -d 3 ${file_source} > ${test_current}object_content-line_1-depth_2-name_depth_2_same_across_sets-at_2-depth_3.expect
- if [[ $? -ne 0 ]] ; then return 1; fi
+ if [[ ${?} -ne 0 ]] ; then return 1; fi
fi
return 0
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_run() {
- last_command="fss_read ${@}"
+ last_command="fss_read \"${@}\""
- fss_read "$@"
+ fss_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_0000() {
- last_command="fss_basic_read ${@}"
+ last_command="fss_basic_read \"${@}\""
- fss_basic_read "$@"
+ fss_basic_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_0001() {
- last_command="fss_extended_read ${@}"
+ last_command="fss_extended_read \"${@}\""
- fss_extended_read "$@"
+ fss_extended_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_0002() {
- last_command="fss_basic_list_read ${@}"
+ last_command="fss_basic_list_read \"${@}\""
- fss_basic_list_read "$@"
+ fss_basic_list_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_0003() {
- last_command="fss_extended_list_read ${@}"
+ last_command="fss_extended_list_read \"${@}\""
- fss_extended_list_read "$@"
+ fss_extended_list_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_0008() {
- last_command="fss_embedded_list_read ${@}"
+ last_command="fss_embedded_list_read \"${@}\""
- fss_embedded_list_read "$@"
+ fss_embedded_list_read "${@}"
- return $?
+ return ${?}
}
generate_operate_run_000e() {
- last_command="fss_payload_read ${@}"
+ last_command="fss_payload_read \"${@}\""
- fss_payload_read "$@"
+ fss_payload_read "${@}"
- return $?
+ return ${?}
}
generate_operate_test_standard() {
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_test_standard_special_cases() {
if [[ ${standard} == "0008" ]] ; then
generate_operate_test_standard_special_cases_0008
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
fi
- return $failure
+ return ${failure}
fi
return 0
generate_operate_run_0008 +n -oc -l 1 -d 1 -n depth_1_set_3_same_name -a 2 -d 3 -a 0 ${file_source} > ${test_current}object_content-line_1-depth_1-name_depth_1_set_3_same_name-at_2-depth_3-at_0.expect &&
generate_operate_run_0008 +n -oc -l 1 -d 2 -n depth_2_same_across_sets -a 2 -d 3 ${file_source} > ${test_current}object_content-line_1-depth_2-name_depth_2_same_across_sets-at_2-depth_3.expect
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
fi
- return $failure
+ return ${failure}
fi
return 0
unset generate_cleanup
}
-generate_main "$@"
+generate_main "${@}"
local hash_build=
local hash_expect=
- if [[ $path_build == "" ]] ; then
+ if [[ ${path_build} == "" ]] ; then
echo "ERROR: No build path specified."
return 1
fi
- if [[ $path_expect == "" ]] ; then
+ if [[ ${path_expect} == "" ]] ; then
echo "ERROR: No expect path specified."
return 1
fi
- path_build=$(echo ${path_build} | sed -e 's|^//*|/|' -e 's|/*$|/|')
- path_expect=$(echo ${path_expect} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_build=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_build})
+ path_expect=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_expect})
if [[ ! -d ${path_build} ]] ; then
echo "ERROR: The build path '${path_build}' either does not exist or is not a directory."
return 1
fi
- if [[ $test_name != "" ]] ; then
+ if [[ ${test_name} != "" ]] ; then
test_name=" for ${test_name}"
fi
basename_file=$(basename ${i})
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: basename ${i} failed."
let failure=1
hash_build=$(md5sum ${path_build}${basename_file} | sed -e 's| .*$||')
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: md5sum ${path_build}${basename_file} | sed -e 's| .*$||' failed."
let failure=1
hash_expect=$(md5sum ${path_expect}${basename_file} | sed -e 's| .*$||')
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: md5sum ${path_expect}${basename_file} | sed -e 's| .*$||' failed."
let failure=1
break
fi
- basename_file=$(echo -n ${basename_file} | sed -e 's|\.expect$||')
+ basename_file=$(sed -e 's|\.expect$||' <<< ${basename_file})
- if [[ $hash_build == $hash_expect ]] ; then
+ if [[ ${hash_build} == ${hash_expect} ]] ; then
echo "[ Success ] ${basename_file}."
let success++
done
- if [[ $fail -gt 0 || $success -gt 0 ]] ; then
- message=" (Success: $success, Fail: $fail)"
+ if [[ ${fail} -gt 0 || ${success} -gt 0 ]] ; then
+ message=" (Success: ${success}, Fail: ${fail})"
fi
echo
- if [[ $failure -eq 1 ]] ; then
+ if [[ ${failure} -eq 1 ]] ; then
echo "Failure! Some or all tests failed${message}${test_name}."
else
echo "Success! All tests passed${message}${test_name}."
fi
- return $failure
+ return ${failure}
}
verify_cleanup() {
unset verify_cleanup
}
-verify_main "$@"
+verify_main "${@}"
local test_set="${1}"
local test_command=
- standard=$(echo -n ${test_set} | sed -e 's|^.*-||g')
+ standard=$(sed -e 's|^.*-||g' <<< ${test_set})
- if [[ $standard == "" ]] ; then
+ if [[ ${standard} == "" ]] ; then
echo "ERROR: No standard specified."
return 1
fi
- if [[ $file_source == "" ]] ; then
+ if [[ ${file_source} == "" ]] ; then
echo "ERROR: No source file specified."
return 1
fi
- if [[ $path_destination == "" ]] ; then
+ if [[ ${path_destination} == "" ]] ; then
echo "ERROR: No destination path specified."
return 1
fi
- file_source=$(echo ${file_source} | sed -e 's|^//*|/|' -e 's|//*|/|' -e 's|/*$||')
- path_destination=$(echo ${path_destination} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ file_source=$(sed -e 's|^//*|/|' -e 's|//*|/|' -e 's|/*$||' <<< ${file_source})
+ path_destination=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_destination})
if [[ ! -f ${file_source} ]] ; then
echo "ERROR: The source file '${file_source}' either does not exist or is not a file."
return 1
fi
- test_base=$(echo ${file_source} | sed -e 's|.*/||g' -e 's|\..*$||')
+ test_base=$(sed -e 's|.*/||g' -e 's|\..*$||' <<< ${file_source})
test_current="${path_destination}${test_base}-"
if [[ ${test_set} == "iki" || ${test_set} == "test-iki" ]] ; then
echo "Generation Complete"
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
let failure=1
echo
echo
fi
- return $failure
+ return ${failure}
}
generate_operate_run() {
if [[ ${test_command} == "eki" ]] ; then
last_command="eki_read ${@}"
- eki_read "$@"
+ eki_read "${@}"
else
last_command="iki_read ${@}"
- iki_read "$@"
+ iki_read "${@}"
fi
- return $?
+ return ${?}
}
generate_cleanup() {
unset generate_cleanup
}
-generate_main "$@"
+generate_main "${@}"
local hash_build=
local hash_expect=
- if [[ $path_build == "" ]] ; then
+ if [[ ${path_build} == "" ]] ; then
echo "ERROR: No build path specified."
return 1
fi
- if [[ $path_expect == "" ]] ; then
+ if [[ ${path_expect} == "" ]] ; then
echo "ERROR: No expect path specified."
return 1
fi
- path_build=$(echo ${path_build} | sed -e 's|^//*|/|' -e 's|/*$|/|')
- path_expect=$(echo ${path_expect} | sed -e 's|^//*|/|' -e 's|/*$|/|')
+ path_build=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_build})
+ path_expect=$(sed -e 's|^//*|/|' -e 's|/*$|/|' <<< ${path_expect})
if [[ ! -d ${path_build} ]] ; then
echo "ERROR: The build path '${path_build}' either does not exist or is not a directory."
return 1
fi
- if [[ $test_name != "" ]] ; then
+ if [[ ${test_name} != "" ]] ; then
test_name=" for ${test_name}"
fi
basename_file=$(basename ${i})
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: basename ${i} failed."
let failure=1
hash_build=$(md5sum ${path_build}${basename_file} | sed -e 's| .*$||')
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: md5sum ${path_build}${basename_file} | sed -e 's| .*$||' failed."
let failure=1
hash_expect=$(md5sum ${path_expect}${basename_file} | sed -e 's| .*$||')
- if [[ $? -ne 0 ]] ; then
+ if [[ ${?} -ne 0 ]] ; then
echo "ERROR: md5sum ${path_expect}${basename_file} | sed -e 's| .*$||' failed."
let failure=1
break
fi
- basename_file=$(echo -n ${basename_file} | sed -e 's|\.expect$||')
+ basename_file=$(sed -e 's|\.expect$||' <<< ${basename_file})
- if [[ $hash_build == $hash_expect ]] ; then
+ if [[ ${hash_build} == ${hash_expect} ]] ; then
echo "[ Success ] ${basename_file}."
let success++
done
- if [[ $fail -gt 0 || $success -gt 0 ]] ; then
- message=" (Success: $success, Fail: $fail)"
+ if [[ ${fail} -gt 0 || ${success} -gt 0 ]] ; then
+ message=" (Success: ${success}, Fail: ${fail})"
fi
echo
- if [[ $failure -eq 1 ]] ; then
+ if [[ ${failure} -eq 1 ]] ; then
echo "Failure! Some or all tests failed${message}${test_name}."
else
echo "Success! All tests passed${message}${test_name}."
fi
- return $failure
+ return ${failure}
}
verify_cleanup() {
unset verify_cleanup
}
-verify_main "$@"
+verify_main "${@}"