17 lines
245 B
Bash
17 lines
245 B
Bash
# retry command every 2 sec until it completes.
|
|
try()
|
|
{
|
|
local result=-1
|
|
|
|
while [ "$result" != 0 ]; do
|
|
$@
|
|
result=$?
|
|
if [ "$result" != 0 ]; then
|
|
sleep 2
|
|
fi
|
|
done
|
|
}
|
|
|
|
# autocomplete.
|
|
complete -F _autocomplete_nested try
|