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
🇫🇷French Ambassador Visits Green University
📌On October 8, 2025, Green University welcomed H.E. Mr. Walid Fouque, the Ambassador of France to Uzbekistan.
💬During the meeting, exciting opportunities for cooperation were discussed — including student exchange programs with top French universities starting from 2026, visits by French experts, creation of a French Language Center, joint research projects, and internships with French companies!
💬As a next step, our university leadership has been invited to visit France this November (10–20) to kick off these partnerships and connect with universities, research centers, and industry reps.
#GreenUniversity#France#InternationalCooperation#StudentExchange#StudyAbroad
✉️ [email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube
Green University Hosts OSCE Academy Delegation
💬Green University welcomed a delegation from the OSCE Academy in Bishkek! During the meeting, Rector Professor Bakhtiyor Pulatov and Anja Mihr discussed cooperation opportunities and reached an agreement on the Student Exchange Program.
💬 Dr. Anja Mihr delivered a presentation for students on Sustainable Development, sharing valuable insights on global challenges and opportunities for youth engagement.
🤝 This visit marks an important step in expanding international cooperation and providing students with new academic and global experiences.
#GreenUniversity#OSCEAcademy#StudentExchange#SustainableDevelopment#InternationalCooperation#GlobalExperience
👉ReadMore _____________________
Green University’da YXHT Akademiyasi delegatsiyasi qabul qilindi
💬Green University Bishkekdagi YXHT Akademiyasi delegatsiyasini qabul qildi! Uchrashuv davomida professor Baxtiyor Pulatov va Anja Mihr hamkorlik imkoniyatlarini muhokama qilib, talabalar almashinuvi dasturi bo‘yicha kelishuvga erishildi.
💬 Dr. Anja Mihr talabalarga Barqaror rivojlanish (Sustainable Development) mavzusida taqdimot o‘tkazdi, global muammolar va yoshlar uchun imkoniyatlar haqida qimmatli ma’lumotlar berdi.
🤝Bu tashrif xalqaro hamkorlikni kengaytirish va talabalarimizga yangi akademik tajribalar yaratish yo‘lida muhim qadam bo‘ldi.
#GreenUniversity#OSCEAcademy#TalabalarAlmashinuvi#SustainableDevelopment#XalqaroHamkorlik#GlobalTajriba
👉Batafsil
✉️[email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube