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
We're excited to be able to support the mission of Tonstarter in bringing #builders, #community and #capital together to accelerate the growth of #TON ecosystem.
Let's keep working towards building a future for TON together! ✨
Full announcement here.
//
About Tonstarter:
▫️Tonstarter is the first TON-native launchpad, enabling crypto projects to raise capital in a decentralized, safe, and user-friendly environment.
Find out more here.
Congratulations Tonstarter on closing a $1.5 million investment seed round! 🎉
We're proud to support your mission to unite #builders, #community, and #capital to accelerate the #growth of TON ecosystem ⚡
It's exciting to be building a bright future together 🫡
Full announcement here.
🚀 Market Conditions Present Opportunities for Strategic Investments, Says DWF Labs Co-Founder
The cryptocurrency market is currently experiencing a "very boring" phase, according to ChainCatcher. DWF Labs Co-Founder Andrei Grachev expressed on social media that while participants may engage in discussions or humor, significant activities such as financing, trading, investing, and business expansion are quietly underway.
Grachev noted that the current market environment poses challenges for major projects, exchanges, and companies to make new listings or significant announcements, as high-profile actions may not be effective at this time. He advised maintaining patience in investment portfolios and waiting for more opportune moments.
He emphasized that the market is not in decline but rather offers opportunities for seemingly mundane activities, such as buying and holding Bitcoin long-term or engaging in altcoin speculation. Grachev concluded that there is still much to do for builders and investors, while smaller investors should focus on learning, avoid lamenting losses, and enjoy the market they have chosen to enter.
#cryptocurrency#marketconditions#investmentopportunities#DWF Labs #AndreiGrachev#bitcoin#altcoin#longtermholding#speculation#investors#builders#patience#learning#BTC