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

Резултати

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

Пребарај: #economy

当前筛选 #economy清除筛选
Indian Development News 🇮🇳

@developmentnewsindia · Post #44320 · 02.05.2026 г., 08:20

India GST collections hit ₹2.43T in Apr’26 vs ₹2.23T (ex-cess) last year, +8.7% YoY; net GST ₹2.11T, +7.3%. Import-linked GST up 25.8%. Despite tax cuts, higher taxable value signals consumption strength; FY27 Centre target ₹10.2T. #Economy

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44303 · 02.05.2026 г., 05:16

Centre to maintain FY27 capex at ₹12.22 lakh crore (+~9% YoY) vs ₹2 lakh crore in FY15. Govt to exit non-strategic sectors to crowd in private investment; LPG imports at ~60% with ~90% via Hormuz flagged as risk. R&D spend at 0.6% of GDP under review. #Economy

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44288 · 01.05.2026 г., 10:15

🇮🇳🤝🇨🇳 India gives fast track nod for China FDI in seven sectors “These are capital goods, electronic capital goods, electronic components, polysilicon and ingot wafer, advanced battery components, rare earth permanent magnets, and rare earth processing” #Economy https://t.co/w0FYHf2dWh

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43661 · 16.04.2026 г., 08:00

According to April 2026 IMF data, India has slipped to the 6th largest economy, falling behind the UK ($4.26T) with a projected FY27 nominal GDP of $4.15 trillion. The decline is not due to a reduction in real economic growth, but primarily caused by a weakening Indian Rupee against the US Dollar and a downward revision of nominal GDP following a base-year change in Feb 2026. #Economy

Hashtags

123•••10•••20•••3031
ПретходнаСтраница 1 од 31Следна