瀏覽代碼

[Update.sh] Test if var is int

andryyy 8 年之前
父節點
當前提交
d1f14bc62b
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      update.sh

+ 5 - 0
update.sh

@@ -149,6 +149,11 @@ for container in $(grep -oP "image: \Kmailcow.+" docker-compose.yml); do
 	for existing_tag in ${EXISTING_TAGS[@]}; do
 		V_MAIN_EXISTING=${existing_tag/*.}
 		V_SUB_EXISTING=${existing_tag/*.}
+
+		# Not an integer
+		[[ ! $V_MAIN_EXISTING =~ ^[0-9]+$ ]] && continue
+		[[ ! $V_SUB_EXISTING =~ ^[0-9]+$ ]] && continue
+
 		if [[ $V_MAIN_EXISTING == "latest" ]]; then
 			echo "Found deprecated label \"latest\" for repository $REPOSITORY, it should be deleted."
 			IMGS_TO_DELETE+=($REPOSITORY:$existing_tag)