I am reading about the pitfalls of parsing ls and the examples given are about looping ls with for/while. The article title says 'parsing ls' - does that mean piping the output of ls to awk and other programs is just as bad?
ls /my/path/ | awk '{print $NF}'
When piping output of ls to other programs, is it better to loop a glob instead?
for p in /my/path/*; do
echo "$p" | awk '{print $NF}'
done
I assume since ls can potentially output newlines etc piping ls directly to other programs is also 'a bad practice' but I don't see much information in that respect.