There is a fairly simple bash script. The script displays the paths of all files and folders in the specified directory. It seems to display everything more or less correctly, but the last found file is always displayed with

Cannot open [No such file or directory]

 currentPos=`pwd` while `read -rd $'\0' file`; do echo "$file" done < `find ${currentPos}/dir0` 

Why and how to avoid it?

  • Please describe in words what your script should do. - aleksandr barakin
  • @alexanderbarakin added - I. Smirnov

1 answer 1

In response to your previous question, I have already suggested how to use the read command.

I will write again, adhering to your example as much as possible:

 currentPos=`pwd` find ${currentPos}/dir0 | \ while read file; do echo "$file" done 
  • yes, thank you, inattentively read) - I. Smirnov