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
🎮Mobile Games in Q3 2020
First-time installs of mobile games climbed nearly 28 percent Y/Y last quarter to 14.2 billion across the #AppStore and #GooglePlay globally. The majority of installs came from Google Play, which grew 36.8% from 8.7 billion in 3Q19 to 11.9 billion. Conversely, the App Store actually saw game installs decline slightly Y/Y, decreasing 4.2% from 2.4 billion in the previous year to 2.3 billion in 3Q20. This figure reflects a decrease in mobile game installs from China’s App Store; outside of China, first-time game installs were up slightly.
InnerSloth’s #AmongUs was a breakaway hit, reaching No. 1 among the top-downloaded games of 3Q20 with installs that were more than 13 times what it saw in 3Q19.
Read more on SensorTower.
#MobileGames
🦅@perspectiveix
ByteDance, the company behind TikTok, has received its first game license. In China, games have to be approved first by the Chinese State Administration of Press, Publication, Radio, Film, and Television (SAPRFT) before being released to the public. In March, 51 games including Warrior Girl Parkour have gained licenses as part of the fifth and latest batch of games of approved games by the authorities (c) KrAsia
#china#tiktok#bytedance#mobilegames#chinanews
Unlock unlimited fun & winning at Rummy24.
Download the App Now👉https://rummy24.sng.link/Averc/fcz2/lcft
.
.
.
#Rummy24#RummyApp#PlayRummy#UnlimitedFun#PlayRummy#onlinerummy#cardsgame#mobilegames#mobilegaming#mobilegame#cardgames#onlinegame#play#skills#win
Weekend Reading for Entrepreneurs
Explore this week's top news: 1️⃣ Research on mobile game success probability - Read more2️⃣ Tech trends for 2025 according to Andreessen Horowitz - Find out more3️⃣ Video on David Lieb, creator of Google Photos - Watch here4️⃣ Podcast with Vlad Tenev from Robinhood - Listen in5️⃣ David Kahn's AI predictions for 2025 - Read the article6️⃣ Interview with Rocket Lab CEO Peter Beck - Explore the interview7️⃣ Turning mistakes into success with Flamp.io - Learn how
#MobileGames#TechTrends#GooglePhotos#Podcast#AI#RocketLab#StartupSuccess#Sequoia#AndreessenHorowitz#VladTenev#DavidLieb#DavidKahn#PeterBeck#Flamp#YCombinator#SpaceX#Entrepreneurship#Innovation#Research#Investment#Finance