add sleep_until
This commit is contained in:
parent
597764a0ba
commit
ae29e54968
1 changed files with 13 additions and 0 deletions
13
.config/shell/functions/sleep-until
Normal file
13
.config/shell/functions/sleep-until
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Usage: sleep_until <time>
|
||||||
|
# Ex: sleep_until 3:00 pm
|
||||||
|
|
||||||
|
sleep_until() {
|
||||||
|
if [ -n "$1" ] && date --date="$*" > /dev/null 2>&1; then
|
||||||
|
echo "Sleeping until: $(date --date="$*")"
|
||||||
|
|
||||||
|
sleep $(( $(date -f - +%s- <<< "$*"$'\nnow') 0 ))
|
||||||
|
else
|
||||||
|
echo "Please input a date"
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue