am encountering strange behavior when executing the following bash script:
for dir in $dirs ; do
for file in $files ; do
line=$(head -n -1 $dir/$file)
Instead of the echo of $line, I am getting the results of a ls / command, followed by the echo of $line, followed by the contents of $files. My guess is that I am exceeding some limit in bash: I have 171 directories, each with 500 files. When I add the line:
to the script, I get the right answer (68); but the echo of $line fills my terminal window. What can I do now?