Jordan Savant # Software Engineer

#!/bin/bash

# Get the command passed
cmd=$1

# Move it off of the argument list
shift

# Assign the remaining args to be args for the passed command
args=$@

# Capture the output of the command
out=$($cmd $@)

# Loop until and repeat command until there is some output
until [[ $out != '' ]]
do
    sleep 1
    out=$($cmd $@)
done

# Echo captured output and quit
echo $out