• + 0 comments

    my solution

    #!/bin/bash
    declare -a array
    i=0
    #storing country names in the array
    while read -r country; do
        array[$i]=$country
        ((i++))
    done
    
    for ((j=0;j<i;j++)); do
        if [[ $j -ge 3 ]] && [[ $j -le 7 ]]; then
            echo -n "${array[$j]} "
        fi
    done | paste -sd ' '