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