#!/bin/bash # 需要直到执行成功的命令 command="repo sync" $command # 返回值赋给 $result result=$? echo "result = "$result until [ $result -eq 0 ] do echo "retry" $command result=$? done