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
🎉 It Finally Happened: SEC Approves SPOT BTC-ETFs! 🚀
💡What This Means: SPOT BTC-ETFs let investors get into Bitcoin through more traditional investment avenues. This brings in more investors and makes the crypto market more like the traditional financial market.
🤝Join SLEX Exchange, catch the bull run wave, and trade Bitcoin to boost your earnings on the spot market!
#CryptoNews#SECBTCETF#Bitcoin#CryptoAdoption#FinancialMileston
Website| Telegram | Reddit | Facebook | Instagram | Medium | Linkedin | Twitter
🚀 Polygon Stablecoin Supply Hits Record High of $3.6 Billion
The stablecoin supply on the Polygon network has reached a new peak, totaling $3.6 billion. According to NS3.AI, this milestone was confirmed by data from Artemis, indicating that the network has achieved an all-time high in stablecoin holdings. This development highlights the growing adoption and utilization of stablecoins within the Polygon ecosystem.
#Polygon#Stablecoin#Crypto#Blockchain#DeFi#Cryptocurrency#DigitalAssets#CryptoAdoption#CryptoNews#FinTech#POL
Bitcoin Rise and Market Liquidations
Bitcoin reaches $94,000, indicating market volatility. In 24 hours, $655 million liquidated from crypto assets. USDt-TON sees accelerated growth: over 1 billion issued and integrated with major exchanges. Telegram adoption boosts usage, making crypto accessible to 950 million users. Read more on market events and USDt-TON's progress through Watcher Guru and other sources.
#Bitcoin#Crypto#USDC#USDt-TON #TON#Telegram#WhaleAlert#MarketTrends#Liquidation#Blockchain#Stablecoin#Investing#Altcoins#VentureCapital#FinTech#Web3#DataAnalysis#CryptoAdoption
U.S. Must Lead in Crypto Regulation
U.S. Treasury Secretary Bessent emphasizes the need for the U.S. to take a global lead on cryptocurrency. Key points include bringing Bitcoin transactions onshore and ceasing government Bitcoin sales. Notably, the evolving regulatory landscape also aims to foster greater adoption of cryptocurrencies in the U.S.
#Crypto#U.S. #Bitcoin#Regulation#SEC#BTC#Blockchain#Innovation#CryptoAdoption#Finance#Bessent#Investment#CryptoPolicy#DigitalAssets#Mainstream#MarketTrends#Tech
Uniswap Expands Crypto-to-Fiat Options
Uniswap collaborates with Robinhood, MoonPay, and Transak to enable seamless crypto-to-fiat transactions. Users across 180+ countries can convert crypto and deposit funds directly into bank accounts via the mobile wallet. This feature will soon be available on the browser extension and web version. For more details, visit Leviathan News.
#Uniswap#Crypto#Robinhood#MoonPay#Transak#Banking#Fiat#DEX#Blockchain#Finance#Tech#Global#Innovation#Payments#Wallet#Transactions#Defi#Onboarding#CryptoAdoption#VC
🚀 Bitcoin Bancorp Expands Bitcoin ATM Network in Southern California
Bitcoin Bancorp has announced the launch of a licensed Bitcoin ATM network in Southern California, with the first machines now operational in the Los Angeles area. According to Odaily, this marks a new phase in the company's retail expansion in the United States, following its previous deployment in Texas, highlighting its strategy to accelerate growth in key markets.
Data indicates that the United States currently hosts over 35,000 Bitcoin ATMs, with the industry expected to grow from approximately $267 million in 2025 to $7.68 billion by 2034. California, with its large population, advanced tech ecosystem, and high rate of cryptocurrency adoption, is a significant growth market, ranking among the top states in the nation for ATM installations, second only to states like Texas.
#BitcoinBancorp#BitcoinATM#SouthernCalifornia#LosAngeles#RetailExpansion#Cryptocurrency#BitcoinMarket#CaliforniaTech#CryptoAdoption#USBitcoinATMs#ATMInstallations#BitcoinGrowth#BTC