我想优化这个Bash脚本,因为加载所需的时间会大大影响它成功的可能性。是否有针对bash的优化器?你能帮我优化吗?
A="0"
B=0
C=0
D=0
until [ $SUCCESS -eq 1 ]; do
TWEET=$(t update "This tweet is the best tweet https://twitter.com/notnowwww/status/$URL")
num1=${TWEET[@]:51:18}
if [ $URL -eq $num1 ]; then
SUCCESS=1
exit
fi
MIN=$(($num1-$num1save))
echo $MIN
URL=$(($num1+$MIN))
yes | t delete status $num1
num1save=${TWEET[@]:51:18}
done
到目前为止,我所做的最佳优化是
A="0";B=0;C=0;D=0;
until [ $B -eq 1 ]; do
E=$(t update "This tweet is the best tweet https://twitter.com/notnowwww/status/$A");D=${E[@]:51:18}
if [ $A -eq $D ]; then
B=1;exit
fi
F=$(($D-$C));A=$(($D+$F));yes|t delete status $D;C=${E[@]:51:18}
done
我甚至为它做了一个git。 https://github.com/quitequinn/MetaTweet