TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #411 · 9 фев.

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

Резултати

Пронајдени 17 слични објави

Пребарај: #yellowfever

当前筛选 #yellowfever清除筛选

#YellowFever is transmitted through the bite of an infected mosquito. If you experience any of the following symptoms: Bleeding (from the nose, ears, or mouth) ➡️Sudden fever ➡️Body pain ➡️Severe headache Report to a health care facility near you immediately

Hashtags

As with #cholera, cases of #yellowfever also increase during the rainy season. Mosquito control helps reduce the risk of #Yellowfever infection. Ensure you: ✅Get rid of stagnant water ✅Keep your environment clean ✅Keep your water containers covered properly ✅Wear protective clothing to prevent mosquito bites #TakeResponsibility

Our guidelines on Infection Prevention & Control for #ViralHemorrhagicFevers include standard operating procedures and checklists to be used in the care & management of VHFs such as #LassaFever & #YellowFever. Healthcare workers are urged to read & share via 🔗https://ncdc.gov.ng/themes/common/docs/protocols/341_1707300274.pdf

Our guidelines on Infection Prevention & Control for #ViralHemorrhagicFevers include standard operating procedures & checklists to be used in the care & management of VHFs such as #LassaFever & #YellowFever Healthcare workers are urged to read & share via https://ncdc.gov.ng/themes/common/docs/protocols/111_1579986179.pdf

#Yellow Fever is an acute viral infection spread by the bite of infected mosquitoes . The disease can cause mild illness in some, but in severe cases it may lead to life-threatening complications. 👉 Protect yourself and those around you by: ✔️ Getting vaccinated ✔️ Preventing mosquito bites ✔️ Seeking medical care if symptoms appear Together, we can eliminate the threat of Yellow Fever. 💪✨ #YellowFever#StaySafe#HealthyLiving#NCDCNigeria

12
ПретходнаСтраница 1 од 2Следна