Custom function to run a command in a loop in bash/zsh
function loop() {
for ((;;)) { eval "$@" }
}
If you place this in your ~/.zshrc
, ~/.bashrc
, or equivalent then you can use it like so:
loop echo "hello"
To stop running the command you can press Ctrl c.