Hi All,
I understand the reason the following snippet of code will not work
because the pipe invokes a sub-shell.
COUNTER=0
DISKS=()
DISKS_NAME=()
grep "^disk[0-9]*=" /etc/diskinfo |
while read LINE;
do
DISKS[${COUNTER}]=`echo ${LINE}|sed -e "s/.*=//"`
DISKS_NAME[${COUNTER}]=`echo ${LINE}|sed -e "s/=.*//"`
COUNTER=$((${COUNTER} + 1))
done
What is the best way to populate an array with the contents of a file
when you need to transform each line read from the file?
while read LINE; do ...; done < <(grep ...)
Thanks