Linux command
do 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Execute command
do [command] [args]
Execute with count
do -n [5] [command]
Execute with interval
do -i [2] [command]
Execute until success
do -s [command]
说明
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.
参数
- -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.
FAQ
What is the do command used for?
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.
How do I run a basic do example?
Run `do [command] [args]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -n _COUNT_ do in do?
Number of iterations.