yoshi2292 yoshi2292 - 1 year ago 68
Bash Question

Concatenating file names into string for a function

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:


for line in $(cat list.txt)
x=" "

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?

Answer Source
  1. Change the last line to mv $A ./stuff

That should work with files that do not have space in their names.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download