fish-shell / fish-shell

The user-friendly command line shell.

Home Page:https://fishshell.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add an easy way to retry a command until it succeeds

DeflateAwning opened this issue · comments

I'm looking for something that will keep retrying a command until it succeeds. This would be an awesome example to add to the documentation.

A place for fish to standout above others would be a very simple way to do this, in contrast to the bash way of writing a complex while loop and remembering a bunch of rules.

An example of a place I'll use this is rsync, where I need it to restart and keep trying if it experiences a failure.

Using fish 3.3.1

Any shell will have a while loop, and any shell will have some way to invert the condition.

In fish's case it would be:

while not rsync...; end

I don't believe adding a shortcut for that is warranted and does not match fish's philosophy - code golf has never been a priority.