-
Notifications
You must be signed in to change notification settings - Fork 0
man mill
mill
- run a command in loop
mill [-p PERIOD|-i] [-q|-b|-B] [-M] [-T TIMEOUT] [-F FILE] [-G] [-C CONDITION] COMMAND...
Run a shell command in loop. The command is executed in the current shell environment.
Each cycle of the loops is composed of several stages :
- record information relative to
-T
,-F
,-G
- the COMMAND is executed
- latency stage :
- test the condition options (
-M
,-T
,-F
,-G
,-C
) - if any is true, exit latency stage
- wait PERIOD
- if any condition option specified, restart latency stage
- test the condition options (
- start a new cycle
The prompt string used when the --quiet
option is absent can be customized with the variables MPS1
and MPS2
.
The syntax is similar to the syntax of PS1
and PS2
.
The COMMAND can retrieve its own exit status returned during the last cycle with $?
. The status is initialized to 0
.
The CONDITION command(s) can retrieve the exit status of the current cycle execution of COMMAND with $?
.
mill
handles the break
and continue
statements, which interrupt the executed shell command :
- in the COMMAND,
break
will end the loop, whilecontinue
will start the latency stage - in a CONDITION, beside the interruption of the command,
break
is equivalent to a zero exit status (ends the latency stage), whilecontinue
is equivalent to a non zero exit status (move on to the next condition)
COMMAND
: the command(s) to execute, evaluated with eval
-p
, --period
PERIOD
: latency between two cycles, in seconds (default 0.2)
-i
, --instant
: don't wait between cycles (similar to -p 0
); generally used with -C
or other
-M
, --manual
: wait for the user to press [ENTER]
-T
, --timeout
TIMEOUT
: if the time is up since the beginning of the cycle, go to the next cycle
-F
, --track-file
FILE
: if this file was modified during the current cycle, go to the next cycle; globbing is activated (as for track --glob
) and patterns are separated by |
, allowing to specify multiple files within one argument
-G
, --track-command-files
: mill -G -- COMMAND
is roughly equivalent to mill -F COMMAND -- COMMAND
; all command arguments are added to the list of tracked files
-C
, --condition
CONDITION
: if this command succeeds, go to the next cycle; this command can be used to set an arbitrary latency
-q
, --quiet
: output only the COMMAND output (default if session is not interactive)
-b
, --unbuffered
: fancy output in real time (default if any condition option specified and session is interactive)
-B
, --buffered
: fancy output, printed when the command execution ends (default if no condition option specified and session is interactive)