I want to iterate over each line in the output of: ls -l /some/dir/*
Right now I\'m trying: for x in $(ls -l $1); do echo $x; done
So, why didn't anybody suggest just using options that eliminate the parts he doesn't want to process.
On modern Debian you just get your file with:
ls --format=single-column
Further more, you don't have to pay attention to what directory you are running it in if you use the full directory:
ls --format=single-column /root/dir/starting/point/to/target/dir/
This last command I am using the above and I get the following output:
bot@dev:~/downloaded/Daily# ls --format=single-column /home/bot/downloaded/Daily/*.gz
/home/bot/downloaded/Daily/Liq_DailyManifest_V3_US_20141119_IENT1.txt.gz
/home/bot/downloaded/Daily/Liq_DailyManifest_V3_US_20141120_IENT1.txt.gz
/home/bot/downloaded/Daily/Liq_DailyManifest_V3_US_20141121_IENT1.txt.gz