Thanks for replying so quickly.

Of course, I tried xargs first, and it works fine on Solaris, but on
Linux (I'm using slackware 7.1), I get the following behavior:

    >find /cdrom -type f | xargs md5sum
    xargs: environment is too large for exec

I don't understand which portion of the universe is responsible for
specifying environment size, but it seems on Solaris to be determined by
the value of ARG_MAX from /usr/include/limits.h.  It might be a POSIX
thing.  I didn't find such a parameter in my Linux limits.h.

I needed to get the task at hand done, so I felt that modifying md5sum
was approachable.  Given the wide variety of configurations out there, it
seemed that my mod might be useful to others.

If you can give me an idea where to file my environment size complaint,
I'll be glad to do so.  As I say, having this ability in md5sum may be
useful beyond it's immediate appearance.  For instance, I was able to do
the following:

    find /cdrom -type f | md5sum -f - | (cd /; md5sum -c) | grep -v OK

/ken


]  X-Authentication-Warning: ixi.eng.ascend.com: meyering set sender to 
][EMAIL PROTECTED] using -f
]  Sender: [EMAIL PROTECTED]
]  Cc: [EMAIL PROTECTED]
]  From: Jim Meyering <[EMAIL PROTECTED]>
]  Date: 30 Jul 2000 21:37:07 +0200
]  User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6.92
]  Content-Type: text/plain; charset=us-ascii
]  Content-Length: 1102
] 
]  Thanks for the suggestion and patch.
] 
]  I suspect that command line length limitations have prompted
]  you to suggest this change.  If so, it would be more in the Unix
]  spirit to use xargs to solve your problem.
] 
]  Let's say you have a list of files in F and you want to run md5sum on
]  each of those.  If the list is long enough, then you can't simply run
] 
]    md5sum `cat F`
] 
]  because the expansion of `cat F` would make your command line longer
]  than the maximum.  The `xargs' program was designed to handle just this
]  sort of situation.  You can do this instead
] 
]    xargs md5sum < F
] 
]  and xargs will run md5sum on batches of many files from F until it has
]  run it on all of them.
] 
]  If you have some other motivation, please let me know.
] 
] 
]  Ken Dawson <[EMAIL PROTECTED]> writes:
]  | In keeping track of content changes on large numbers of files, I have
]  | found that giving md5sum the ability to take the list of file names to be
]  | processed from a file rather than from the command line argument list is
]  | quite helpful.  I include the mods I made to the 2.0 version of the
]  | source to implement this feature.
]  ...

Reply via email to