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
🌍 In 2021, Europe's Aegean wildfires generated smoke that reached as far as the North Pole—a rare journey showing how natural disasters can have effects thousands of kilometers away. ✨
#disasters⚡#wildfire⚡#atmosphere⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
Firefighting crews battle wildfire near Reagan ranch
California firefighters took advantage of a break in strong winds to get aircraft aloft and dump retardant on a fast-moving wildfire that was within a half mile of former President Ronald Reagan's ranch, officials said.
#News#Reuters#Wildfire#California
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
🔥😱GEORGIA WILDFIRE EXPLODES TO $22,600 ACRES
🔹 Brantley County fire doubles overnight from $11K to $22.6K acres — only 6% contained 🌲
🔹 90 homes destroyed in worst residential wildfire loss in Georgia history 🏠💔
🔹 Evacuation orders for 6,000 residents as winds fuel rapid spread through dry forest 🌪️
🔹 Emergency crews from 5 counties battling flames with limited water access 🚒
🔹 Governor declares state emergency, requesting federal aid for disaster relief 🆘
This is why climate change isn't just talk — it's burning down America piece by piece 🔥🇺🇸
#Georgia#wildfire#ClimateChange#EmergencyAlert
@america
$30M Funding for Stand Insurance
Stand Insurance secured $30M in funding on December 16, 2024. This company specializes in providing tailored coverage for high-value homes, employing science-backed solutions to protect against wildfires in California's vulnerable regions.
#Funding#Insurance#Wildfire#California#HomeProtection#StandInsurance#HighValueHomes
#The_Science🇺🇸📕[PDF]⬇️
2 #October2025
#Weekly_Magazines
For learning, for free(dom).
@backupofmagazines
This issue explores breakthroughs in #cancer treatment with radioisotope drugs, urgent debates on #wildfire management, and novel insights into #quantum battery charging. Features include fossil repatriation from the Netherlands to #Indonesia, brain nanotube networks, and volcanic unrest in Chile. Research spans from ancient #DNA revealing mammoth evolution to quantum optics reshaping imaging. With perspectives on #climate change, plastics policy, and microbial plant colonization, the issue highlights science at the intersection of #innovation, environment, and global policy.
#The_National_Geographic🇺🇸📕[PDF]⬇️
#November2025
#Monthly_Magazines
For learning, for free(dom).
@backupofmagazines
This issue tours big frontiers: a colossal #NuclearFusion tokamak in France promises star power on Earth; botanists curate the world’s deadliest garden; a teenage Sherpa resets who belongs on alpine peaks; macro art peers through a bug’s eye; new science reframes adult #ADHD; crested gibbons show robotlike dances; wildfire imagery from the #SierraNevada; archaeologists ink themselves to decode ancient tattoos; and medics test human hibernation for deep-space care. Essential reading for explorers and pragmatists alike. #NationalGeographic#Climate#Energy#Biodiversity#Wildfire#Photography#Neuroscience#Space#Innovation#Science#Sustainability#Tokamak#Fusion amid accelerating #AI research and #GlobalTrends, shaping tomorrow’s decisions.