Making carriage-return IFS global rather than subfunction specific

parse-mdls
Mike Holloway 2 years ago
parent 2da31a5355
commit 2729af8349
  1. 8
      hash-files

@ -5,6 +5,8 @@ md5_bin=$(which md5sum)
mktemp_bin=$(which mktemp)
DateTimeStamp=$(date +\%D_\%T)
IFS=$'\n'
set -a
source .env 2>&1 > /dev/null
set +a
@ -23,16 +25,13 @@ write_log () {
create_list_of_files () {
#echo "=== Get list of files in $Working_Directory. ===
#=================================================="
IFS=$'\n'
for file in $(find $Working_Fullpath -maxdepth 1 -type f); do
list_of_files+=( $file )
done
write_log "List of files created successfully."
unset IFS
}
mdls_files () {
IFS=$'\n'
for file in $list_of_files; do
for line in $(mdls $file); do
mdls_key=$(printf "%s" $line | cut -d '=' -f 1)
@ -49,13 +48,11 @@ mdls_files () {
hash_files () {
#echo "=== Hash files. ===
#======================"
IFS=$'\n'
for file in ${list_of_files[@]}; do
hash=$($md5_bin $file | awk '{ print $1 }')
list_of_hashes+=( $hash )
done
write_log "Files hashed successfully."
unset IFS
}
create_csv () {
@ -104,3 +101,4 @@ mdls_files
#done
unset IFS

Loading…
Cancel
Save