Bug fixed

This commit is contained in:
yulewang 2018-07-01 19:23:38 +08:00
parent 7b79226b7a
commit 774878f6a1

View File

@ -101,8 +101,8 @@ ID_FILE=$HOME/.id-cf.txt
if [ -f $ID_FILE ] && [ $(wc -l $ID_FILE | cut -d " " -f 1) == 4 ] \ if [ -f $ID_FILE ] && [ $(wc -l $ID_FILE | cut -d " " -f 1) == 4 ] \
&& [ "$(sed -n '3,1p' "$ID_FILE")" == "$CFZONE_NAME" ] \ && [ "$(sed -n '3,1p' "$ID_FILE")" == "$CFZONE_NAME" ] \
&& [ "$(sed -n '4,1p' "$ID_FILE")" == "$CFRECORD_NAME" ]; then && [ "$(sed -n '4,1p' "$ID_FILE")" == "$CFRECORD_NAME" ]; then
CFZONE_ID=$(head -1 $ID_FILE) CFZONE_ID=$(sed -n '1,1p' "$ID_FILE")
CFRECORD_ID=$(tail -1 $ID_FILE) CFRECORD_ID=$(sed -n '2,1p' "$ID_FILE")
else else
echo "Updating zone_identifier & record_identifier" echo "Updating zone_identifier & record_identifier"
CFZONE_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones?name=$CFZONE_NAME" -H "X-Auth-Email: $CFUSER" -H "X-Auth-Key: $CFKEY" -H "Content-Type: application/json" | grep -Po '(?<="id":")[^"]*' | head -1 ) CFZONE_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones?name=$CFZONE_NAME" -H "X-Auth-Email: $CFUSER" -H "X-Auth-Key: $CFKEY" -H "Content-Type: application/json" | grep -Po '(?<="id":")[^"]*' | head -1 )