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

Резултати

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

Пребарај: #studentssuccess

当前筛选 #studentssuccess清除筛选
Andijan Development Center

@adceducate · Post #8253 · 12.03.2024 г., 13:25

We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥 Abrorbek Patiddinov B2/52 Nozimaxon Akbarova: B2/53 And Muhammadali Abdumalikov C1/65 Their teacher: Mr.Shermuhammad 🎉 Congratulations on their initial academic accomplishments!!! 🎉 And, we hope to see them get high results from IELTS, as well! We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝 To join our courses, call 742281121 #studentssuccess ADC - The Way To Knowledge

Andijan Development Center

@adceducate · Post #8141 · 11.01.2024 г., 12:21

We would like to share CEFR results from our MAIN branch, a.ka. home of real achievers 🥳🔥 So, here we go! Bexruz; B2/53 (L and R: 58) Shoxjahon; B2/58 (L 64 and Sp 66) Rahmonberdi; B2/54 (L 57 and Sp 56) Diyora; B2/61 (L 73 🥳 R 67 🔥) And Asliddin; C1/66 (L 70 and R 68) 🎉 Congratulations on their initial academic accomplishments!!! 🎉 And, we hope to see them get high results from IELTS, as well! We also would like to extend our gratitude to their teacher, Mr. Shermuhammad, for his tireless efforts to produce such results week in and week out! 🤝 To join our courses, call 742281121 #studentssuccess ADC - The Way To Knowledge

Andijan Development Center

@adceducate · Post #8251 · 11.03.2024 г., 12:46

YANA BIR BAND 7️⃣.0️⃣👑 🤜BAND 7.0🤜 LISTENING: 7.0 🚀 READING: 7.5 🤓 WRITING: 6.5✍️ SPEAKING: 7.0 🔥 Full Name: Charos Rustamova👑 Attempt: 1st ✨ With British Council Age: 16 🤯 Teacher: Mr. Shermuhammad (8.5) General English, working hard and choosing the right teacher are the key elements to success in IELTS🍸 #ieltsresult#studentssuccess#band70#mainoffice THINK IELTS, THINK ADC