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

Резултати

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

Пребарај: #tongochi

当前筛选 #tongochi清除筛选
Tongochi channel

@tongochi_game · Post #389 · 08.01.2024 г., 19:09

🔍 We are looking for 4 people to join the Tongochi Ambassador program. We are seeking ambassadors who are skilled and passionate about creating content on social media in the following languages: - Russian - English - Spanish - Korean - Chinese - Persian - Turkish - Bahasa If you have been playing Tongochi for some time, know what developer coupons are, understand how our staking works, and are willing to create content on YOUR TG channel or Twitter account (preferably if you already manage an account), and if you also want to receive payment in $PET, then you are exactly who we need 😁 Here's how to become an ambassador: - Publish a post about Tongochi on your account with the hashtags #tongochi#PET. - Share the link to your post in the comments below this post (the one you are reading). - At the end of the week, we will contact the winners. What kind of content you can create: - Videos (long, short) - Text posts - Memes - Video memes - Video tutorials - Art This is all part of our preparation for listing on an exchange, and we need the help of ambassadors. Make Tongochi Great For Ever 🍷

Tongochi Game Juego P2E basado en Telegram chatbot ❇️ Cría la mascota ❇️ Participa en batallas ❇️ Recolecta ítems y cajas comunes y épicas ❇️ Compra y vende en el market place ❇️ Gana NFTs y Tokens PET, TON... Comienza a jugar pulsando aquí #tongochi#PET