I’m trying to concatenate a bunch of files into a string so I can use them for a function. As a test script I’m trying to do this:
#!/bin/bash for line in $(cat list.txt) do x=" " A=$A$line$x done echo "$A" mv "$A" ./stuff
but I’m getting the error:
mv: cannot stat ‘x.dat y.dat z.dat ’: No such file or directory
but they are most definitely there
can I get some advice please?
Advertisement
Answer
- Change the last line to
mv $A ./stuff
That should work with files that do not have space in their names.