SLEEPENH(1)
๐ค SLEEPENH(1) โ user commands, but make it a whole vibe ๐ค
okay bestie, sit down, hydrate, because we're talking about sleepenh โ the enhanced sleep program โ and honestly? it's giving main character energy in the shell-scripting world. ๐ซถ
โจ NAME โจ
sleepenh โ an enhanced sleep program ๐
๐ SYNOPSIS ๐
sleepenh [[--warp|-w] INITIALTIME] TIMETOSLEEP
๐ DESCRIPTION ๐
so here's the tea, bestie: sleepenh is the program you reach for when you need to run stuff periodically inside a shell script. ๐
and like โ important โ it was not designed to be accurate for one single sleep. it's designed to be accurate across a sequence of consecutive sleeps. that's the whole point, that's the moment, no cap. โจ
after it runs successfully, it prints to stdout the timestamp it finished running. and that value? you feed it back in as INITIALTIME to the next sleepenh call. it's a little relay race and it's iconic. ๐โ๏ธ๐จ
๐ธ OPTIONS ๐ธ
-h,--helpโ display this help and exit ๐ซก-w,--warpโ warp the resulting timestamp, for when there's no need to sleep. an immediately following call ofsleepenhwith the resultingTIMESTAMPwould most probably result in a real sleep. ๐-V,--versionโ output version information and exit ๐
๐ฆ ARGUMENTS ๐ฆ
TIMETOSLEEPโ a real number in seconds, with microseconds resolution. so like, 1 minute, 20 seconds and 123456 microseconds would be80.123456. math but make it cute. ๐งฎโจINITIALTIMEโ also a real number in seconds, with microseconds resolution. heads up though: this number is system dependent. on GNU/Linux systems it's the number of seconds since midnight1970-01-01 GMT. โณ
โ ๏ธ do not try to get a good value ofINITIALTIMEyourself, bestie. just use the value supplied by a previous execution ofsleepenh. trust the process. ๐
if you don't specify INITIALTIME, it's assumed to be the current time. easy. ๐
๐ EXIT STATUS ๐
an exit status greater or equal to 10 means failure. here's the known lineup:
0โ Success. ๐1โ Success. There was no need to sleep. (this means thatINITIALTIME+TIMETOSLEEPwas greater than current time). ๐ด10โ Failure. Missing command line arguments. ๐11โ Failure. Did not receiveSIGALRM. ๐ญ12โ Failure. Argument is not a number. ๐ข๐13โ Failure. System error, could not get current time. ๐ฅ
๐ USAGE EXAMPLE ๐
suppose you need to send the char 'A' to the serial port ttyS0 every 4 seconds. this will do that, fr fr:
#!/bin/sh
TIMESTAMP=$(sleepenh 0)
while true; do
# send the byte to ttyS0
echo -n "A" > /dev/ttyS0;
# just print a nice message on screen
echo -n "I sent 'A' to ttyS0, time now is ";
sleepenh 0;
# wait the required time
TIMESTAMP=$(sleepenh $TIMESTAMP 4.0);
done
๐ง HINT ๐ง
this program can be used to get the current time. just execute:
sleepenh 0
and boom, you're a time lord now. โฐ๐
๐ญ BUGS ๐ญ
it is not accurate for a single sleep. short TIMETOSLEEPs will also not be accurate. she's a group-project girlie, not a solo act. ๐
๐ฅ SEE ALSO ๐ฅ
๐ AUTHOR ๐
this manual page was written by Pedro Zorzenon Neto. ๐
and that's the whole page, bestie โ this version of the sleepenh manual is from 2024-12-09, and it's filed under the sleepenh name in the user commands section. sleep tight, literally. ๐คโจ๐
๐ฆ where this page comes from
- debian trixie: sleepenh 1.8-1 ยท GPL-2.0-or-later
- ubuntu questing: sleepenh 1.8-1
- ubuntu resolute: sleepenh 1.8-1build1 ยท GPL-2.0-or-later
- ubuntu stonking: sleepenh 1.8-1build1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms