LinuxCommandLibrary

do

command repetition utility

TLDR

Execute command repeatedly

$ do [command] [args]
copy
Execute with count
$ do -n [5] [command]
copy
Execute with interval
$ do -i [2] [command]
copy
Execute until success
$ do -s [command]
copy

SYNOPSIS

do [options] command [args...]

DESCRIPTION

do is a simple utility for repeatedly executing commands. It provides options for controlling iteration count, timing, and termination conditions based on command exit status.
The tool is useful for polling operations, retrying failed commands, and automated testing scenarios. It offers a simpler interface than while loops for common repetition patterns.
Various implementations of 'do' exist with different feature sets. Behavior may vary depending on which version is installed.

PARAMETERS

COMMAND

Command to execute.
ARGS
Arguments to pass to command.
-n COUNT
Number of iterations.
-i SECONDS
Interval between executions.
-s
Stop on success (zero exit).
-f
Stop on failure (non-zero exit).
--help
Display help information.

CAVEATS

Name may conflict with shell builtins or other utilities. Different implementations have different options. May need escaping for shell-interpreted arguments.

HISTORY

Multiple utilities named 'do' exist across different systems and package repositories. The concept of command repetition is fundamental to shell scripting, with various tools providing convenient interfaces.

SEE ALSO

watch(1), while(1), repeat(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community