TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:1777] directory sizes



>>>>> "Hans" == Hans Umhoefer <spudling@acm.cs.umn.edu> writes:

    Hans> On Mon, 19 Oct 1998, Andrew McCulloh wrote:
    >> Be sure to use back ticks: ` not '

    Hans> Ahh, I see. Cool trick.

The back ticks create a subshell and execute the ls -d */. in it. If
you are using bash you should be able to do the same thing with 

	du -s <(ls -d */.)

I tried this from my home directory and got the following:

shaft:~$ du -s <(ls -d */.)
0       /proc/self/fd/63


Now cat <(ls -d */.) gives the right results--got to dig deeper on
this one.

    >>
    Hans> du -s */.
    >>  This works but there is a problem with it. You can see the
    >> difference between this and my solution by doing

    Hans> Hmm, odd. ls */. and ls -d */. give quite different output
    Hans> but du -s */.  and du -s `ls -d */.` give exactly the same
    Hans> output. I ran the commands in /usr/local so there are a lot
    Hans> of directories below the current one.

As you can see above du -s is pretty odd. I wrote my 1st response
before actually trying du -s */. My response was based on what I
expected to happen given the difference between ls */. and ls -d
*/. But this didn't happen--because of the odd interplay between a
file list and what ls does with it. To see how your shell interpolates 
*/. type 
	echo */. 
and see what you get.

Andrew