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

Резултати

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

Пребарај: #ammunition

当前筛选 #ammunition清除筛选
Crypto M - Crypto News

@CryptoM · Post #65043 · 10.04.2026 г., 15:45

🚀 U.S. Prepares Military Response Amid Iran Peace Talks, Says Trump U.S. President Donald Trump has stated that if peace negotiations with Iran fail, American warships are being equipped with advanced ammunition to resume strikes. According to Odaily, Trump's comments came shortly before U.S. Vice President Vance boarded Air Force Two en route to Islamabad for peace talks with Witkoff and Kushner. In a phone interview, Trump expressed uncertainty about the success of the negotiations, saying, "We will know in about 24 hours. We are rearming our ships with the finest ammunition and the most advanced weapons, even better than what we used before, which had already defeated them. If no agreement is reached, we will use them very effectively." Trump further commented on the unpredictability of the situation, stating, "We are dealing with people whose honesty is uncertain. They claim to abandon all nuclear weapons in front of us, but then tell the media they want to enrich uranium. We will find out the truth." #US#Trump#Iran#MilitaryResponse#PeaceTalks#Ammunition#Warships#NuclearWeapons#Uncertainty#Diplomacy#Pakistan#AirForceTwo