docs: update

This commit is contained in:
Dylan Araps 2018-06-13 12:31:24 +10:00
parent 73e5774d04
commit f9d55836a4
1 changed files with 15 additions and 0 deletions

View File

@ -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.