|
From: Masatake Y. <je...@gy...> - 2006-08-02 13:54:09
|
> As for readarray, sure, I think reading in a file into an array
> quickly is a generally useful thing. Python has a fancier module
> called linecache. Volunteers for sheparding this through?
Before, contacting to Chet Ramey, I'd like to have some discussions.
1. How do you think rename readarray to readfile?
I think the shell script writer may be confused read -a and readarray.
readfile is more specific name.
2. I think it is better to make readarray options are similar to read.
char *readarray_doc[] = {
"Copy the lines from the input file into an array variable.",
"Use the `-n' option to specify a count of the number of lines to copy.",
"If -n is missing all lines are copied.",
"Use the `-O' option to specify an index orgin to start the array.",
"If -O is missing the origin will be 0.",
"Use -t to chop trailing newlines (\\n) from lines.",
"To read from stdin use '-' as the filename.",
In stead of specifying filename, how do you think fd like
"read -u fd"? You can slow away `-'.
3. Do you think callback is needed?
readarray is fast enough, so I think callback arguments is
overkilling. I tried more than 10000 lines configure. However,
it takes no time to read.
Masatake
|