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

Резултати

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

Пребарај: #parties

当前筛选 #parties清除筛选
Bali News

@balinews · Post #285 · 04.01.2025 г., 12:11

🪩Nick Fanciulli at Savaya Bali 📆 Sunday, 12 January Nic Fanciulli is a respected figure in electronic music, recognised for his Grammy-nominated remix of Gorillaz's ‘Dare’ and for founding the influential Saved Records label. His credits include projects such as The Social festival with top artists, as well as appearances at venues such as Space Ibiza and Tomorrowland, cementing his legacy in the dance music scene. 🔍 Details of the event, as well as tickets, are available on the official website. @BaliNews #wheretogo#events#parties

Bali News

@balinews · Post #230 · 29.10.2024 г., 03:07

🥳A four-day Halloween party in Kuta 🔔 Starting tomorrow, October 30, Old Man's will be hosting a series of Halloween parties starting at 5:00pm. Come dressed to impress as your favorite ghoul, ghost, or Halloween character for a chance to win big in our spine-chilling costume contest. 🎫 Tables for one-day start from Rp2,400,000 – included entrance fee for 4 pax, 1 bottle of house pouring and 4 mixers. 👨‍💻 More information via the link. @BaliNews #wheretogo#parties#Kuta

Bali News

@balinews · Post #434 · 12.06.2025 г., 14:04

🪩 There will be a party at Savaya on Saturday ℹ️ Building upon her cultural heritage and her musical tastes (the artist grew up listening to artists such as Nina Simone, Bob Marley and Marvin Gaye), AWEN started to produce her unique style of Afro-house. 🧞‍♀️ It mixed electronic instrumentation with timeless melodies - and a touch of spirituality. 📲 More info and tickets (Rp 600,000) are here. #wheretogo#parties#Badung@BaliNews

Bali News

@balinews · Post #383 · 06.04.2025 г., 13:50

⭐️Electronic music star Boris Brejcha in Bali 📍 Savaya Bali 📆 May 18, 2005 ⏰ Doors Open at 1:00 pm 🔞 Entry strictly 21+ 🎟 Rp1,350,000 🪩 German DJ Boris Brejcha is known to all lovers of techno and mind-blowing parties. As part of his world tour he will be stopping by Bali. 🔎 More information and tickets here. @BaliNews #events#parties#Badung

Bali News

@balinews · Post #335 · 27.02.2025 г., 12:16

🪩Morabito presents Bombossa Brothers 📍 Morabito Art Villa, Canggu 📅 Friday, February 28 ⏰ 6:00 pm Bombossa Brothers are twins with two interesting personalities and one mission: to entertain as many people as possible with their groovy melodic sound. Over the past couple of years, they have built up their reputation as a duo to watch by playing around the world and expanding their Momentum event series, hosting up to 2000 people in their hometown of Tallinn, Estonia. 🎫Tickets at the link from 250.000 IDR. @BaliNews #wheretogo#parties#Canggu