reload_flag=""
if [[ -n "${DEBUG}" ]]; then
reload_flag="--reload"
fi
if [[ -n "${WORKER_COUNT}" ]]; then
workers=${WORKER_COUNT}
else
workers=2
fi
gunicorn --workers ${workers} \
--bind 0.0.0.0:8000 \
${reload_flag} main.wsgi
Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно?
На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX.
:- для установки значений по умолчанию
${WORKER_COUNT:-2}
Если переменная не объявлена, то будет дефолтное значение 2.
:+ подставляет указанный текст, если переменная не пуста
${DEBUG:+--reload}
Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере.
Итого наш скрипт может выглядеть так:
gunicorn --workers ${WORKER_COUNT:-2} \
--bind 0.0.0.0:8000 \
${DEBUG:+--reload} main.wsgi
Есть еще два оператора.
:= не только подставить дефолтное значение, но и присвоить его переменной, если она пуста
# никаких переменных еще нет
VAL1=${VAL2:=hello}
# теперь доступны обе
echo $VAL1 $VAL2
# hello hello
:? остановить выполнение с ошибкой, если переменной нет.
echo ${MISS:?is required}
bash: MISS: is required
Код выхода будет 1.
#tricks#linux
https://descubreenmexico.com/por-que-la-semana-santa-cambia-cada-ano-de-fecha/
#SemanaSanta
Este mes de abril muchos mexicanos y cristianos celebran la Semana Santa, es decir, la conmemoración anual de la Pasión de Cristo.
¿Qué es la pasión de Cristo?
Esta semana relata la entrada de Jesús a Jerusalén, su última cena, el viacrucis, su muerte y resurrección.
¿Cuándo es la Semana Santa este año?
Este año, la Semana Santa se celebra desde el domingo 24 de marzo hasta el domingo 31 de marzo.
¡Ardor para la fachiza!
El #AIFA sigue ganado visitantes nacionales e internacionales.
A la derecha no le gusta saber que México avanza, por eso inventan historias de fracasos.
#SemanaSanta#AIFA
¡Atención! ☝🏻
🔴 El gobierno de #DelfinaGómez (@delfinagomeza) llamó a la población a evitar el uso de fogatas y pirotecnia en zonas forestales durante el periodo vacacional de #SemanaSanta🌳🪵👇🏻
https://revistaelpolitico.com/estados/gobierno-del-edomex-pide-proteger-bosques-semana-santa/
"Mucho amor y buenas vacaciones" ❤️🌴
🔴 A través de un video desde #PalacioNacional, #Sheinbaum envió un mensaje a mexicanos por #SemanaSanta e informó cuáles son sus planes para estos días 👩🏻📹
¡Hay que presumirlo! 😎
La presidenta #Sheinbaum echa abajo el montaje de #FedericoDöring🤡
‼️Esta #SemanaSanta el AIFA tuvo 64 mil 525 pasajeros en 1,233 vuelos ✈️
¡Aunque no le guste a los prianistas! 😌
Le darán su #SemanaSanta al Tío Richie 😅
🔴 La #SCJN discutirá la próxima semana dos proyectos que, de validarse, representarán un nuevo golpe legal a #SalinasPliego👊🏻💰
https://sinlineamx.com/scjn-alista-doble-reves-legal-contra-grupo-salinas/
In Spain, Good Friday is part of Semana Santa (Holy Week). Cities hold large religious processions.
Groups called brotherhoods organize these events. People wear long robes and pointed hoods. They walk slowly as an act of penance.
Huge floats called “pasos” show scenes from the crucifixion of Jesus. These can weigh over a ton and are carried by teams underneath.
Some cities have music with drums and bands. Others stay completely silent. People also sing emotional songs from balconies.
In Seville, processions can last all night. In Málaga, there is a tradition of pardoning a prisoner. In Valladolid, old sculptures from the 16th and 17th centuries are used.
Traditional foods include torrijas and buñuelos.
🇪🇸🕯️🎭🥁
[Read more 1]
[Read more 2]
@googlefactss
#GoodFriday#SemanaSanta#Spain#Traditions#History#Culture