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 слични објави

Пребарај: #lightspeedfaction

当前筛选 #lightspeedfaction清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #3426 · 18.12.2024 г., 13:35

Plume Network Secures $20M Funding Plume Network, an EVM-compatible Layer 2 blockchain focused on Real World Assets (RWA), raised $20M in funding. The round was led by notable investors including Brevan Howard Digital, HAUN Ventures, Lightspeed Faction, and Galaxy Digital. #Funding#PlumeNetwork#Layer2#Blockchain#EVM#RealWorldAssets#BrevanHoward#HAUNVentures#LightspeedFaction#GalaxyDigital

Venture Village Wall 🦄

@venturevillagewall · Post #3509 · 19.12.2024 г., 20:47

Flock Secures $3M in Funding Web3 AI training firm Flock has successfully raised $3M in a strategic funding round led by Digital Currency Group (DCG). Notable participants included Lightspeed Faction, Animoca Brands, Fenbushi Capital, Gnosis DAO, Bas1s Ventures, A41, and GSR Markets LTD. #Web3#AI#Funding#Flock#DigitalCurrencyGroup#LightspeedFaction#AnimocaBrands#FenbushiCapital#GnosisDAO#Bas1sVentures#A41#GSRMarkets

Venture Village Wall 🦄

@venturevillagewall · Post #3432 · 18.12.2024 г., 14:37

Aave Raises $31M for Lens Protocol Aave protocol developer secures $31M in a strategic funding round for Lens Protocol, spearheaded by Lightspeed Faction. Notable investors include Alchemy Ventures, Circle Ventures, and ConsenSys, among others. #Aave#LensProtocol#Funding#LightspeedFaction#AlchemyVentures#CircleVentures#ConsenSys#DigitalFinanceGroup#FabricVentures#ForesightVentures#Superscrypt#Re7Capital#WintermuteVentures#CaliberVentures#G20Group#BlockchainCoinvestors#BorderlessCapital#BodhiVentures#AlexGluchowski#AleksanderLarsen