/* BeejBløg */

Oct 26, 2015 - 1 minute read - Comments

Bash script – loop over inline list of files



# read args:
# -r = disable backslash escaping
# -d '' = read the whole here-doc as one big input vs stopping stopping at the first new line as the default delimiter
# -a = put the results into an array
#the minus in "<<-" provides for indenting the here-doc lines, but with TABS ONLY
#bash4 is way easier but wanted to be portable: readarray -t arr <<-"EOT"
IFS=$'n' read -r -d '' -a arr <<-'EOF'

#echo ${#arr[*]}

# https://stackoverflow.com/questions/9084257/bash-array-with-spaces-in-elements
# disable default space delimiter
for filePath in ${arr[*]}
  stat "${filePath}"

unset IFS