I am trying to write a script in which there is a function that outputs the file line by line:

linePr (){ while read LINE; do echo $LINE; done < $1 } 

In this case, the name or path to the file is entered in the first parameter of the script. However, at startup, the following error appears:

 ./program: 6: ./program: cannot open : No such file 

The file exists and is properly formatted.

How to solve this problem?

  • Alexander, why do you give here the code of only one function from the whole of your script? Do you think that the error is in this function? - rugabarbo
  • Add this command first to the function: pwd; echo $ 1 . Write the output. - 0andriy

0