1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#!/bin/shell
input="links.txt"
echo "print line by line"
printf "Line 1\nLine 2\nLine 3\n" | ( mapfile; echo "${MAPFILE[@]}" )
echo "-----------------------"
echo "print all lines"
printf "Line 1\nLine 2\nLine 3\n" | ( mapfile -t; echo "${MAPFILE[@]}" )
echo "-----------------------"
mapfile array < $input
echo "print line by line from file"
echo "${array[@]}" | (mapfile; echo "${MAPFILE[@]}" )
echo "-----------------------"
echo "print all lines from file"
echo "${array[@]}" | (mapfile -t; echo "${MAPFILE[@]}" ) |