mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-22 12:57:01 +00:00
add 'current time point for N days ago or after'
This commit is contained in:
parent
794d4ba7b3
commit
3cf8bdfe46
15
README.md
15
README.md
@ -1145,6 +1145,21 @@ date --date @1615852800
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Print current time point for N days ago or after N days
|
||||||
|
```bash
|
||||||
|
# get this time a day ago
|
||||||
|
date -d"1 day ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time tomorrow
|
||||||
|
date -d"-1 day ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time 7 days ago
|
||||||
|
date -d"1 week ago" +"%F %H:%M:%S"
|
||||||
|
|
||||||
|
# get this time a week ago
|
||||||
|
date -d"7 day ago" +"%F %H:%M:%S"
|
||||||
|
```
|
||||||
|
|
||||||
##### wait for random duration (e.g. sleep 1-5 second, like adding a jitter)
|
##### wait for random duration (e.g. sleep 1-5 second, like adding a jitter)
|
||||||
```bash
|
```bash
|
||||||
sleep $[ ( $RANDOM % 5 ) + 1 ]
|
sleep $[ ( $RANDOM % 5 ) + 1 ]
|
||||||
|
Loading…
Reference in New Issue
Block a user