Skip to main content
added 72 characters in body
Source Link
Manabu Nakazawa
  • 2.2k
  • 1
  • 24
  • 26

If the elements of FILES come from another file whose file names are line-separated like this:

2011-09-04 21.43.02.jpg
2011-09-05 10.23.14.jpg
2011-09-09 12.31.16.jpg
2011-09-11 08.43.12.jpg

Thenthen try this so that the whitespaces in the file names aren't regarded as delimiters:

while read -r line; do
    FILES+=("$line")
done < ./files.txt

If they come from another command, you need to rewrite the last line like this:

while read -r line; do
    FILES+=("$line")
done < <(./output-files.sh)

If the elements of FILES come from another file whose file names are line-separated like this:

2011-09-04 21.43.02.jpg
2011-09-05 10.23.14.jpg
2011-09-09 12.31.16.jpg
2011-09-11 08.43.12.jpg

Then try this:

while read -r line; do
    FILES+=("$line")
done < ./files.txt

If they come from another command, you need to rewrite the last line like this:

while read -r line; do
    FILES+=("$line")
done < <(./output-files.sh)

If the elements of FILES come from another file whose file names are line-separated like this:

2011-09-04 21.43.02.jpg
2011-09-05 10.23.14.jpg
2011-09-09 12.31.16.jpg
2011-09-11 08.43.12.jpg

then try this so that the whitespaces in the file names aren't regarded as delimiters:

while read -r line; do
    FILES+=("$line")
done < ./files.txt

If they come from another command, you need to rewrite the last line like this:

while read -r line; do
    FILES+=("$line")
done < <(./output-files.sh)
Source Link
Manabu Nakazawa
  • 2.2k
  • 1
  • 24
  • 26

If the elements of FILES come from another file whose file names are line-separated like this:

2011-09-04 21.43.02.jpg
2011-09-05 10.23.14.jpg
2011-09-09 12.31.16.jpg
2011-09-11 08.43.12.jpg

Then try this:

while read -r line; do
    FILES+=("$line")
done < ./files.txt

If they come from another command, you need to rewrite the last line like this:

while read -r line; do
    FILES+=("$line")
done < <(./output-files.sh)