تمرين إعادة البناء
Deploy Checklist
أعد كتابة سكربت Bash يعرض قائمة تحقق للنشر بدون تنفيذ أي نشر فعلي.
bash
~13 دقيقة
متوسط
أعد بناء الكود
Rebuild
هذا هو الكود. اكتبه بنفسك.
الكود المرجعي
#!/usr/bin/env bash
# Deploy checklist with per-step status using an associative array.
# `declare -A` requires Bash 4+. macOS ships Bash 3.2.57 by default, so we
# guard up front with a clear remediation message.
set -euo pipefail
if ((BASH_VERSINFO[0] < 4)); then
echo "هذا السكربت يحتاج Bash 4 أو أحدث (macOS الافتراضي 3.2.57)" >&2
echo "استخدم: brew install bash && /usr/local/bin/bash $0" >&2
exit 2
fi
steps=(
"build assets"
"run tests"
"review changelog"
"backup current release"
"wait for approval"
)
declare -A status=(
["build assets"]="done"
["run tests"]="done"
["review changelog"]="pending"
["backup current release"]="pending"
["wait for approval"]="blocked"
)
for step in "${steps[@]}"; do
state="${status[$step]:-pending}"
printf '[%-7s] %s\n' "$state" "$step"
doneاكتب هنا