• narshee@iusearchlinux.fyi
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    cat
    while read -r l; do echo "$l"; done <

    cat -n
    while read -r l; do echo "$l"$; done <

    cat -e
    n=0; while read -r l; do n="$((n+1))" printf ' %d %s\n' "$n" "$l"; done <

    cat -b
    n=0; while read -r l; do [ -n "$l" ] && n="$((n+1))" && printf ' %d %s' "$n" "$l"; echo; done <