I haven't done much bash scripting in the past (this is probably only my fourth or fifth script I have created). The current script i'm making will repeat a command (the script's argument) until it completes without failing. But before it starts repeating the command I want to check that it's an actual command. How could I check this? Edit: Here is the current code I have written (not much)
#!/bin/bash
while true; do #This while loop keeps repeating the first argument (which should be a command) until it finishes without failing
if ($1); then
echo "success"
break;
else
echo "fail"
echo;
fi;
done;