You can simplify things a bit by putting command
right in the test and doing increments a bit differently. Otherwise the script looks fine:
NEXT_WAIT_TIME=0
until [ $NEXT_WAIT_TIME -eq 5 ] || command; do
sleep $(( NEXT_WAIT_TIME++ ))
done
[ $NEXT_WAIT_TIME -lt 5 ]
More Related Contents:
- Timeout a command in bash without unnecessary delay
- How can I escape white space in a bash loop list?
- Emulating a do-while loop in Bash
- How do you run a command eg chmod, for each line of a file?
- Looping through alphabets in Bash
- Is there a better way to run a command N times in bash?
- How to loop through dates using Bash?
- Looping through all files in a directory [duplicate]
- Execute a shell function with timeout
- Bash scripting, multiple conditions in while loop
- Syntax for a single-line while loop in Bash
- How to iterate over list which contains whitespaces in bash
- Reading lines in a file and avoiding lines with # with Bash
- Can a shell script set environment variables of the calling shell? [duplicate]
- How can I count all the lines of code in a directory recursively?
- How does Ctrl-C terminate a child process?
- Running multiple commands in one line in shell
- Variable variable assignment error -“command not found”
- How to Batch Rename Files in a macOS Terminal?
- How to pass arguments to Shell Script through docker run
- Print a character repeatedly in bash [duplicate]
- BASH Syntax error near unexpected token ‘done’ [duplicate]
- Why variable values are lost after terminating the loop in bash? [duplicate]
- How to use `while read` (Bash) to read the last line in a file if there’s no newline at the end of the file?
- Save file to specific folder with curl command
- Assign output to variable in Bash [duplicate]
- How to get the nth positional argument in bash?
- How to assign a glob expression to a variable in a Bash script?
- Access arguments to Bash script inside a function [duplicate]
- What’s the difference between “here string” and echo + pipe