The following will read from an external file and output the data:
#!/bin/bash
while IFS='|' read hostname nickname; do
echo $hostname $nickname
done < "list.dat"
Where the list.dat file is:
firstserver|joe
secondserver|henry
thirdserver|jack
But I'd like to actually store the list.dat in the script itself (not externally) but don't know how to reference it as a variable/array and read from it with the same results...