0

Using bash, I am reading a file line by line with the following code:

for entry in "$2"*; do
    while read LINE
        do 
        #handler $LINE
        echo $LINE
    done < $entry
done

Where $2 is the file name. (you can find the file here: https://gist.github.com/floriancastelain/2a956dcd01174ed8c207f93d7e4645f2)

However, I expected the output of echo to be only the lines of the file. But instead I got this (sorry for the image, but formatting the console output is a pain in the ass) :

enter image description here

Note the elements such as /bin /boot /cdrom /dev /etc /home /initrd.img /initrd.img.old /lib or jersey mdoc.bash util. Where do these come from and how to avoid them ?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Itération 122442
  • 2,644
  • 2
  • 27
  • 73

0 Answers0