Array in linux shell without creating file

array=$(ls -1; echo "end of file";)
printf %s "$array" | while IFS= read -r line
do {
echo $line
} done
Another way using sed
array=$(ls -1 | sed '$aend of file')
printf %s "$array" | while IFS= read -r line
do {
echo $line
} done

No comments: