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
#Policy_Brief: Coercion Over Consent: #Ethiopia’s dangerous mandatory Digital ID experiment
In this policy brief, Mohamed A. argues that Ethiopia's mandatory Digital ID (#Fayda) is a "flawed and dangerous policy," not because identification itself is problematic, but because enforcement lacks legal safeguards. He emphasizes that centralizing sensitive data risks turning governance into a tool of "surveillance, control, and exclusion."
According to him, Ethiopia is "importing the concept as if it were a proven model." In Ethiopia's fragile institutional context, this amounts to "recklessness disguised as modernization," especially with foreign funding raising unresolved questions about "who controls the data."
The author urges authorities to "pause enforcement" until trust and oversight are established, arguing that without them, mandatory ID is "not progress—it is a poorly designed and dangerous policy."
https://addisstandard.com/?p=54995
🚨 Public announcements 🚨
We’re excited to announce a *TikTok Challenge* to showcase your creativity and skills! 🎥
Theme: Highlight the features and benefits of our *Passenger Online Booking* service.
How to Participate:
1️⃣ Create an engaging TikTok video in *Amharic, English, Afaan Oromo, Af Somali, Afar*.
2️⃣ Include the Online Booking requirements is *National ID* in your video.
3️⃣ Be creative, original, and fun!
Deadline: Submit your video by Monday, February 17, 2025.
🎉 Prize:
The winner will receive a *cash bonus* and *special recognition* for their outstanding creativity!
Join the content creators' group by scanning the QR code to submit your videos. We can’t wait to see your creations!
#EthioDjiboutiRailway#ComingSoon#TravelMadeEasy#StayTuned#DigitalEthiopia#Fayda