A variable modified inside a while loop is not remembered
echo -e $lines | while read line … done The while loop is executed in a subshell. So any changes you do to the variable will not be available once the subshell exits. Instead you can use a here string to re-write the while loop to be in the main shell process; only echo -e … Read more