docs:bash:bash_loop

This is an old revision of the document!


bash loop

  • This example will loop through all files and folders, and determine their disk usage (note that this particular example can actually be done without a bash loop, using only the du command)
ls -1L *.tiff | while read file;do
du -h -d 0 "${file}"
done
  • :!: This code will NOT work on filenames with spaces
  • note that the symbols used are backticks, not single quotes (backtick is the key left of 1)
for file in `ls -1L`;do
du -h -d 0 $file
done
  • docs/bash/bash_loop.1179164475.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)