I am trying to read the output of a command in bash using a while loop
.
while read -r linedo echo "$line"done <<< $(find . -type f)
The output I got
ranveer@ranveer:~/tmp$ bash test.sh./test.py ./test1.py ./out1 ./test.sh ./out ./out2 ./helloranveer@ranveer:~/tmp$
After this I tried
$(find . -type f) | while read -r linedo echo "$line"done
but it generated an error test.sh: line 5: ./test.py: Permission denied
.
So, how do I read it line by line because I think currently it is slurping the entire line at once.
Required output:
./test.py./test1.py./out1./test.sh./out./out2./hello