docs: update
This commit is contained in:
17
README.md
17
README.md
@@ -30,6 +30,7 @@ scripts and not full blown utilities.
|
|||||||
* [Get the first N lines of a file.](#get-the-first-n-lines-of-a-file)
|
* [Get the first N lines of a file.](#get-the-first-n-lines-of-a-file)
|
||||||
* [Get the last N lines of a file.](#get-the-last-n-lines-of-a-file)
|
* [Get the last N lines of a file.](#get-the-last-n-lines-of-a-file)
|
||||||
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
||||||
|
* [Iterate over files.](#iterate-over-files)
|
||||||
* [Create an empty file.](#create-an-empty-file)
|
* [Create an empty file.](#create-an-empty-file)
|
||||||
* [Strings](#strings)
|
* [Strings](#strings)
|
||||||
* [Trim white-space from string.](#trim-white-space-from-string)
|
* [Trim white-space from string.](#trim-white-space-from-string)
|
||||||
@@ -117,6 +118,22 @@ lines() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Iterate over files.
|
||||||
|
|
||||||
|
Don’t use `ls`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Greedy example.
|
||||||
|
for file in *; do
|
||||||
|
echo "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
# PNG files in dir.
|
||||||
|
for file in ~/Pictures/*.png; do
|
||||||
|
echo "$file"
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
### Create an empty file.
|
### Create an empty file.
|
||||||
|
|
||||||
Alternative to `touch`.
|
Alternative to `touch`.
|
||||||
|
|||||||
Reference in New Issue
Block a user