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
🔥#GRAM сожгли 50% эмиссии токена
💎 Это стало самым крупным сжиганием в тоне, а также привело к росту в два раза.
Немного истории
Павел Дуров хотел с помощью TON создать децентрализованную блокчейн-платформу для приложений и быстрых транзакций. Целью было интегрировать криптовалюту GRAM в Telegram, позволяя пользователям совершать платежи прямо в мессенджере.
Биржи:
🛒Binance🌐ByBit🌐 OKX
⭐в благодарность за труд ставьте звезду на пост
#Airdrop#листинг#gram
Gram Wallet для Android
Вчера ночью на сайте TON появился Gram Wallet для настольных платформ. Вместе с ним был опубликован исходный код приложений, в том числе и для мобильных устройств.
Мы собрали кошелек для Android.
#Android#gram
MyTonWallet v3.3 update and Gram DNS integration into the wallet
🎁 The year 2025 in the TON blockchain began with a boom in Telegram NFT gifts, and the MTW team responded quickly: #MyTonWallet became the first wallet to provide full visual support for gifts in HD quality with maximum FPS. The wallet logo was also updated, which is especially noticeable when using TON Connect.
Details of the update v3.3:
👛Transparent fees – now when exchanging (swap) you can click the “Info” button to find out the exact cost of the transaction and see how much $TON will be returned back.
👛The new "Explore" v2.0 section is an updated version of the "Overview" tab, which is now in a separate panel. The interface has been redesigned: new banners have appeared, and applications are now conveniently grouped into categories.
👛MyTonWallet Pay is a new tool for paying with cryptocurrency in online stores. The function is currently being tested, and its full launch is expected later. If you have your own store and want to integrate MTW Pay, contact 💬Irina@eeraarons.
📺 We have left short videos under this post so that you can clearly evaluate all the innovations.
☺️Bonus: In honor of the anniversary of Gram DNS, Crypto Bot and MyTonWallet unexpectedly added it to their services.
#TON#MTW#Gram#Gift
🦄🦄Telegram is raising $1.7 billion in funding - and they're not even done!
#Telegram raised $850 million from 94 investors in March in addition to $850 million it gained in February. That's almost two whole unicorns in the largest #ICO (Initial Coin Offering) to date.
The company, founded by self-exiled Russian Pavel Durov, plans to use the ICO proceeds to develop the Telegram Open Network #blockchain, which includes the cryptocurrency #Gram.
Interest in the Telegram ICO has recently helped the company surpass the threshold of 200 million monthly active users, “with over 700,000 new users signing up each day.”
🚀@PerspectiveIX
🌀 http://prs.pctvix.co/TelegramIX