Language: ksh
OS: SunOS
I have been getting the 'subscript out of range' error when the below array variable gets elements greater that 1024. I understand that 1024 is the default size for 'set -A' dynamic array, but is there a way to initialize it with a larger number?
set -A arr `grep 'some pattern' filename`
Is there any other alternative to initilize arrays?
Thanks,
-CB
Older versions of ksh are limited to 1024 elements in an array.
Hi ,
I am facing the same problem.
I know that 1024 is the default size for 'set -A' dynamic array, but is there a way to initialize it with a larger number?
Get a newer version of ksh (or use bash).
1 Like
can you explain me what is the equivalent for set -A arr `grep 'some pattern' filename`
in bash script.
arr=( $(grep 'some pattern' filename) )
(The same syntax works in ksh93.)