We will deliver the "TOKI" (means "Timing" in Japanese) management command to your UNIX computer!
(日本語版はこちら)
This is a command collection to make your UNIX life more convenient! On the current POSIX commands, are you satisfied for timing management? Unfortunately, we aren't. That is because POSIX doesn't release the commands for controling time more accurately and/or more precisely than one second. For instance, image a scene you have to send text data at one second interval accurately. How can you do that with shell script? You can probably do only like that.
cat /PATH/TO/textdata_source |
while IFS= read -r line; do
printf '%s\n' "$line"
sleep 1
done
However, that is not accurate because extra time is required to execute while
~ done
sentence and printf
. So, we made some commands to solve such problems.
To solve the above problem, you can use valve
command by the following.
$ cat /PATH/TO/textdata_source | valve -l 1s
Not only we can solve the problem but also we can make the shell script simpler!
Several more commands are available.
calclock
..... Convert bewteen the Calendar time and UNIX timegetfilets
Display timestamps (mtime, ctime, atime) of a fileherewego
. Sleep Until a Nice Round Time and Tell the Timelinets
..... Add timestamp to every line of text dataoobleck
... Output only a line that the next line does not arrive for a whileptw
........... A command wrapper to prevent a command from full-buffering (alternative of stdbuf, see this for details)relval
..... Limit the Flow Rate of the UNIX Pipeline Like a Relief Valvesleep
....... Sleep command which supports sleeping during less than a second (POSIX compliant)tscat
....... Output each line at the data and time which is written in the top of the linetypeliner
Make a Line of a Bunch of Key Typesvalve
....... Adjust the Data Transfer Rate in the UNIX Pipeline
To see the usages for the commands, build the command and run them with the option --help
.
First, git clone
this repository. Then, run the INSTALLIN.sh
with specifying the install directory. Building and installation progress interactively.
To short, all you have to do is to type the following commands. ("/usr/local/tokideli" is a typical directory for installation)
$ git clone https://github.com/ShellShoccar-jpn/tokideli.git
$ su
# tokideli/INSTALLIN.sh /usr/local/tokideli
Or type the following if you want to install this in your home directoy instead.
$ git clone https://github.com/ShellShoccar-jpn/tokideli.git
$ tokideli/INSTALLIN.sh $HOME/tokideli
You can add the install directory into the environment variable "PATH" by using "INSTALL.sh." Of course, you can do that manually, too.
ShellShoccar Japan, no rights reserved.
Everything in this repository is completely free for everyone. If you want any license to use them by all means, we'll give you CC0 or the Unlicense. Anyway, take them freely as you like.