tags:

views:

31

answers:

1

I want to compare the a list of files in two directories quickly. I can use the following

    $    ls /opt/myapp/ >> ~/myapplist
    $    cksum ~/myapplist
3476215496 7657 /u/compll07/ojblass/myapplist

    $    ls /opt/myapp2/ >> ~/myapp2list
    $    cksum ~/myapp2list
3476215496 7657 /u/compll07/ojblass/myapp2list

And compare the checksums of the output. I would like to just do a cksum of the output of a command and I have tried

$    cksum `ls /opt/myapp/`

But that doesn't work. Is there a slicker way to do this in one command in ksh?

+2  A: 

% echo hello, world | cksum -
1398783287 13 -

- tells cksum to use stdin as input.

cksum actually uses stdin by default anyway:

% echo hello, world | cksum
1398783287 13

I find the second form prettier, actually.

sreservoir

related questions