Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improved lines function #101

Open
Akianonymus opened this issue Apr 26, 2020 · 0 comments
Open

Improved lines function #101

Akianonymus opened this issue Apr 26, 2020 · 0 comments

Comments

@Akianonymus
Copy link

Akianonymus commented Apr 26, 2020

lines function could be easily changed to read from variable, file ( as it does ) and a pipe output. Here is the code that works for me:

Usage: lines < "file" or lines <<< "$variable" or echo something | lines

lines() {
    mapfile -tn 0 lines
    printf '%s\n' "${#lines[@]}"
}

Similar issue that was closed: #85

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant