Is there anyway you could help me understand what you did a little better?
First off I have to correct my own post (++i is sufficient, you don't need (())):
- while IFS= read -r; do
-
names[++i]="$REPLY"
-
done<your_file_here
IFS= and read -r
IFS= is "clearing" the internal field separator,
otherwise leading and trailing IFS characters will
be stripped: for example, a record like " word ... "
becomes "word ...". The -r option for read is necessary
to prevent some escape sequences from being expanded
- \n will not be expanded to a new line for example
(if that's not what you want,
use just
while read;do ...).
names[++i]="$REPLY"
Some recent shells like bash, ksh93 and zsh
accept the syntax ++var and var++
for incrementing the value of a variable.
$REPLY is the default variable for some
statements like
read and
select.
HTH a bit.