Skip to main content
1 of 2
Janis
  • 14.4k
  • 4
  • 28
  • 42

To get both, dir output and size calculation, without using any of the other proposed options, you can use tee(1) and process substitution...

dir | tee >( awk '{ total += $4 }; END { print total }' )

Janis
  • 14.4k
  • 4
  • 28
  • 42