#!/usr/bin/env bash
set -u

# Script Name: tryna
# Description: Retry command until success (every 0.5s)
# Source: https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
# Credit: Evan Hahn - https://codeberg.org/EvanHahn/dotfiles
# Usage: tryna curl https://example.com
#        tryna nc -zv localhost 8080

"$@"
while [[ ! "$?" -eq 0 ]]; do
  sleep 0.5
  "$@"
done
