big_bass,big_bass wrote: this reads one long line only into ${arr[0]}
sometimes arr=$(<somefile) this is used to avoid using cat
but it has its limits and is not an exact replacement command for cat
Code: Select all
arr=$(</etc/rc.d/PUPSTATE) echo ${arr[0]} echo ${arr[1]} echo ${arr[2]} echo ${arr[3]}
Some extra protection and this works-
Code: Select all
arr=(`echo "$(< /etc/rc.d/PUPSTATE)"`)
Regards,
s