mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Create A Sequence Of Values With A Step as a unix til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||||
|
|
||||||
_1130 TILs and counting..._
|
_1131 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1051,6 +1051,7 @@ _1130 TILs and counting..._
|
|||||||
- [Copying Nested Directories With Ditto](unix/copying-nested-directories-with-ditto.md)
|
- [Copying Nested Directories With Ditto](unix/copying-nested-directories-with-ditto.md)
|
||||||
- [Count The Number Of Matches In A Grep](unix/count-the-number-of-matches-in-a-grep.md)
|
- [Count The Number Of Matches In A Grep](unix/count-the-number-of-matches-in-a-grep.md)
|
||||||
- [Create A File Descriptor with Process Substitution](unix/create-a-file-descriptor-with-process-substitution.md)
|
- [Create A File Descriptor with Process Substitution](unix/create-a-file-descriptor-with-process-substitution.md)
|
||||||
|
- [Create A Sequence Of Values With A Step](unix/create-a-sequence-of-values-with-a-step.md)
|
||||||
- [Curl With Cookies](unix/curl-with-cookies.md)
|
- [Curl With Cookies](unix/curl-with-cookies.md)
|
||||||
- [Curling For Headers](unix/curling-for-headers.md)
|
- [Curling For Headers](unix/curling-for-headers.md)
|
||||||
- [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md)
|
- [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md)
|
||||||
|
|||||||
37
unix/create-a-sequence-of-values-with-a-step.md
Normal file
37
unix/create-a-sequence-of-values-with-a-step.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Create A Sequence Of Values With A Step
|
||||||
|
|
||||||
|
The `seq` utility allows you to output a sequence of values.
|
||||||
|
|
||||||
|
You can start at `1` by default.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ seq 3
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|
||||||
|
Or you can specify the starting value.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ seq 10 13
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
```
|
||||||
|
|
||||||
|
Adding a third argument in between those two will specify the step value that
|
||||||
|
should be taken to get from one to the other.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ seq 6 3 15
|
||||||
|
6
|
||||||
|
9
|
||||||
|
12
|
||||||
|
15
|
||||||
|
```
|
||||||
|
|
||||||
|
That sequence starts at 6 and goes to 15 with a step value of 3.
|
||||||
|
|
||||||
|
See `man seq` for more details.
|
||||||
Reference in New Issue
Block a user