I am trying to create a small script that takes a filename, in which the absolute location of files are listed, and to copy it to some other location.
Content of the file test.txt
for example:
/home/public/Music/Disk/GameOfThrones/Season1/01 Main Title.mp3
Script tried:
for file in `cat test.txt`; do cp "$file" temp ; done
However, this script thinks there are three files. Some more searching yield the following file:
OIFS="$IFS"
IFS=$'\n'
for file in `cat test.txt`; do cp "$file" temp ; done
IFS="$OIFS"
which seems to replace each occurrance of the letter 'n' by a newline.
So how to do it correctly?