0
for word in $(cat link_name.list); do 
    echo "$word"; 
done

The for loop does not read contents line by line but as a single line. Not sure why a while loop is preferred to do this?

compuphys
  • 1,289
  • 12
  • 28
Angelo
  • 61
  • 1
  • 8
  • 1
    See https://mywiki.wooledge.org/BashPitfalls#pf1 and https://mywiki.wooledge.org/DontReadLinesWithFor and https://shellcheck.net and it is not just a while loop, you need the `read` builtin for that, Other scripting language like say, `python` does that but not the shell, also you might need to check if that `link_name.list` has carriage returns which is normal for files created in Windows. – Jetchisel Apr 17 '20 at 01:33
  • 1
    Thank you Jetchisel... – Angelo Apr 17 '20 at 02:44

0 Answers0