Shellcheck files and source checker

This commit is contained in:
Dan Schaper 2016-11-16 20:26:53 -08:00
parent 2c55b92453
commit e2037819ac

View file

@ -141,11 +141,10 @@ version_check() {
} }
files_check() { files_check() {
#Check non-zero length existence of ${1}
header_write "Detecting existence of ${1}:" header_write "Detecting existence of ${1}:"
local search_file="${1}" local search_file="${1}"
if [[ -s ${search_file} ]]; then if [[ -s ${search_file} ]]; then
echo "::: File exists" log_echo "File exists"
file_parse "${search_file}" file_parse "${search_file}"
return 0 return 0
else else
@ -156,9 +155,13 @@ files_check() {
} }
source_file() { source_file() {
local file_found=$(files_check "${1}") \ local file_found
&& (source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \
file_found=$(files_check "${1}")
if [[ "${file_found}" ]]; then
(source "${1}" &> /dev/null && echo "${file_found} and was successfully sourced") \
|| log_echo -l "${file_found} and could not be sourced" || log_echo -l "${file_found} and could not be sourced"
fi
} }
distro_check() { distro_check() {