How To loop this code:
if scp remote-host:~/myfile ./ >& /dev/null
then 
    echo "transfer OK"
else 
    sleep 20
fi
loop must every 20 sec check for file on remote host, if file appear loo开发者_运维知识库p have to exit.
Try:
while true
    if scp remote-host:~/myfile ./ >&/dev/null;
      then echo "transfer OK"; 
    fi
    sleep 20;
done
while true
do
    if scp remote-host:~/myfile . &> /dev/nul
    then
        echo "transfer OK"
        break
    fi
    sleep 30
done
Or, if you prefer something more compact:
while :; do 
    (scp remote-host:~/myfile . &> /dev/null) && break
    sleep 30
done
echo "transfer OK"
Note that : is a built-in null command with a zero (success) exit code.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论