>run the grep command on thousands of files in one directory.
>Since grep only accepts upto 1000 input files at a time, I was
>trying to build a filelist of a thousand files and execute the grep
>when the filelist has a thousand files in it or there are no more
>input files left.
>Thanks for the help,
>Andrew
You've got problems.
You only see that message if you have more arguments on the command
line than your unix kernel can deal with. So, for example, when you
type
foo *c
where foo is the name of your program, your shell expands *c to be
a list of all the files in that directory named (anything ending in c).
You can get around this by passing the wild card to the shell un-expanded.
You can only do this by reading the wild card after the shell has started,
something like
echo "what files do you wish to match? \n"
read files
for list in $files
do
..
done
exit 0
It is important that you *not* quote the variable in the for loop.
This will (should) work because the shell never tries to pass the
huge list of arguments to another program, so it never triggers the
kernel limit.
chris