docs: update
This commit is contained in:
parent
73e5774d04
commit
f9d55836a4
15
README.md
15
README.md
|
@ -24,6 +24,7 @@ list, send a pull request!
|
|||
* [Get the current date using `strftime`.](#get-the-current-date-using-strftime)
|
||||
* [Get the first N lines in a file.](#get-the-first-n-lines-in-a-file)
|
||||
* [Get the last N lines in a file.](#get-the-last-n-lines-in-a-file)
|
||||
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
||||
* [Get the directory name of a file path.](#get-the-directory-name-of-a-file-path)
|
||||
* [Convert a hex color to RGB](#convert-a-hex-color-to-rgb)
|
||||
* [Convert an RGB color to hex.](#convert-an-rgb-color-to-hex)
|
||||
|
@ -93,6 +94,20 @@ tail() {
|
|||
}
|
||||
```
|
||||
|
||||
## Get the number of lines in a file.
|
||||
|
||||
Alternative to `wc -l`.
|
||||
|
||||
**NOTE:** Requires `bash` 4+
|
||||
|
||||
```sh
|
||||
lines() {
|
||||
# Usage lines "file"
|
||||
mapfile -tn 0 lines < "$1"
|
||||
printf '%s\n' "${#lines[@]}"
|
||||
}
|
||||
```
|
||||
|
||||
## Get the directory name of a file path.
|
||||
|
||||
Alternative to the `dirname` command.
|
||||
|
|
Loading…
Reference in New Issue