Last active
July 1, 2026 01:23
-
-
Save angelbladex/5eba16011ea84e5c7849977e3d157cfb to your computer and use it in GitHub Desktop.
Un script para mostrar los días festivos del mes en Colombia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/data/data/com.termux/files/usr/bin/bash | |
| API_KEY="Your_API_KEY" | |
| BASE_URL="https://www.festivos.com.co/api/v1/festivos" | |
| YEAR=$(date +%Y) | |
| MONTH=$(date +%-m) | |
| MESES=(enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre) | |
| MES_NOMBRE=${MESES[$((MONTH-1))]} | |
| RESPONSE=$(curl -s "$BASE_URL?year=$YEAR&month=$MONTH" \ | |
| -H "Authorization: Bearer $API_KEY") | |
| COUNT=$(echo "$RESPONSE" | jq '.data | length') | |
| if [ "$COUNT" -eq 0 ]; then | |
| echo "No hay días festivos en $MES_NOMBRE del $YEAR." | |
| exit 0 | |
| fi | |
| echo "Días festivos $MES_NOMBRE $YEAR" | |
| echo | |
| echo "$RESPONSE" | jq -r '.data[] | "\(.date)\t\(.day_of_week_es)\t\(.name_es)"' | \ | |
| while IFS=$'\t' read -r fecha dia nombre; do | |
| dia_num=$(echo "$fecha" | cut -d'-' -f3) | |
| printf "%s de %s\t%s\t%s\n" "$dia_num" "$MES_NOMBRE" "$dia" "$nombre" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment