• + 3 comments

    I was trying with the parameter expansion

    while read x; do
        echo ${x:2:1}
    done
    

    then I realized that this code never reads the last line, whereas it does with bash on my system. Indeed I also tried with the NON-solution to see if the code replicates the input, but it always removes the last line.

    while read x; do
        echo $x
    done
    

    Can anyone help me understand why?