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
#PAWS Solana OG Allocation
If you have an active Solana wallet, check if you’ve received an airdrop or not.
Here's the full list of the 13 projects in the Solana OG Allocation:
Memecoins:
DogWifHat ($WIF) -
Bonk ($BONK)
Pudgy Penguins ($PENGU)
STONKS ($STNK)
GigaChad ($GIGA)
Eliza ($Ai16z)
DeFi:
Magic Eden ($ME)
Phantom Wallet
Jupiter ($JUP)
Raydium ($RAY)
Solana Phone
Jito ($JTO)
Mad Lads by Backpack
Paws Airdrop Checker: https://paws.community/app/solana-og
#PAWS
The airdrop criteria have appeared on the PAWS website !!
➡Open the PAWS app
➡Tap "Check Eligibility"
➡See if you qualify for the airdrop!
Are you Eligible?
🗿 Yes
😢 No
New Task added in @Paws
Get 5000 Paws by completing this task
👉
Big #PAWS Sighted In These Area! 🐶
New task just dropped.
Put 🐾 in your name and stay on marked trails!
👉 PLAY PAWS : CLICK
#Paws Bot is Verified !!
Just a few days ago, the @PAWS bot launched and within less then 3 days it reached a massive milestone of 10 million users! 🤯 And now, it's officially verified by Telegram! 🎉
👉PLAY : @PAWS
💎PAWS ONE LAST RIDE 💎
The final mandatory check is live!
Only those who finish it will stay in.
Go to PAWS Web & check it off.
P.S. Special roles for holding 10+ Vouchers are now available in PAWS Discord!🐾
#PAWS HIGHER 🐶
💎PAWS ONE LAST RIDE 💎
The final mandatory check is live!
Only those who finish it will stay in.
Go to PAWS Web & check it off.
P.S. Special roles for holding 10+ Vouchers are now available in PAWS Discord!🐾
#PAWS HIGHER 🐶
🔤🔤🔤🔤
Do you like detective stories and puzzles?
Let us analyze the picture and say what can you see and predict for the upcoming listing and TGE?
#Paws
#paws
🐾PAWS 18,000,000 million participants
🔥The project is gaining momentum, the next trail according to the hint in the video is the X Empire project, they should still drop coins for it💎
💵Easy money 10-50$, without doing anything
@PAWS
--------------------------------------------------
🤘Blums code
🗣#PAWS – Upcoming Airdrop for Solana DeFi Users
PAWS has announced an upcoming airdrop, rewarding everyone who has used DeFi on Solana!
🔗Post
💡 What to Expect:
🟠 Rewards for Jupiter swaps
🟠 Perks for NFT purchases on Magic Eden
🟠 Bonuses for using Phantom Wallet
⏳ Now is the time to prepare your accounts for the drop!
☝️ Start trading on Bybit
Crypto Drop Club 👉 SUBSCRIBE