title: While loop for last file in the directories
body: <p>I run this code for getting the list of directories from input file and return last file in each directory</p>
  <pre><code>#!/bin/bash
  while IFS= read -r line; do
  echo &quot;Text read from file: $line&quot;
  ls $line -ltrh |tail -1
  done &lt; &quot;$1&quot;
  </code></pre>
  <p>but its not working
  with this error</p>
  <pre><code>[root@localhost /]# ./last_file.sh new2.txt
  Text read from file: 17609
   No such file or directory
  Text read from file: 17601
  : No such file or directory
  Text read from file: 17608
  : No such file or directory
  Text read from file: 17610
  : No such file or directory
  Text read from file: 12465
  : No such file or directory
  Text read from file: 12356
  : No such file or directory
  Text read from file: 34562
  : No such file or directory
  </code></pre>