TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #411 · 9 фев.

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

Резултати

Пронајдени 4 слични објави

Пребарај: #hexn

当前筛选 #hexn清除筛选
HEXN.IO Channel

@hexnio · Post #1085 · 10.10.2024 г., 16:34

💎Hey, HEXNation! ⏲ Time for a quick activity with prizes! • Repost this post in your Telegram story. • Tag @hexnio and add #HEXN tag to it. • A few extra words would be a nice touch! • Click #HEXN in this post to see our global crew. We'll watch your stories and randomly pick 5 winners to receive a promo-check for 1 $TON each to claim! LET’S GO! 🚀 *️⃣App | 📈Trade | 🧭Links | ✖️Twitter

Hashtags

HEXN.IO Channel

@hexnio · Post #968 · 16.08.2024 г., 15:47

💎Hey, HEXNation! ⏲ Time for a quick check-up on how awesome you all are! Show us your HP farms in your Telegram stories: • Post your HEXN App in stories. • Tag @hexn_bot and add #HEXN tag to it. • Click #HEXN in this post to see our HEXNation! 1-2-3, GO! 🚀 *️⃣App | 💬Chats | *️⃣Website | 𝕏 Twitter

Hashtags

HEXN.IO Channel

@hexnio · Post #888 · 19.07.2024 г., 08:23

🎥 HEXN Video Makers Contest! 🎥 🗓Contest: July 19th - August 1st 🗓Results: August 3rd 🚀 Total Prize Pool: $10,000! 🚀 Think you’ve got what it takes to make an awesome video about HEXN? Here’s how to join: 1. Create a Video: Make a video about HEXN and upload it to 📱 TikTok, 📱 Instagram Reels, or 📱 YouTube Shorts. 2. Get Views: Reach at least 100,000 views on one of these platforms. 3. Submit Your Entry: Once (and only then) you hit 100k views, send us the link through this Google form: https://forms.gle/gaCT89hNXjjjcf8w6 Rewards: 🎉 $50 for 100,000 views 🏆 $300 for 1,000,000 views ‼️Important: • Views must be real, we’ll check that! 🔍 • Add the #hexn tag to your video! • Your video can be in any genre.🎬 🙌We were blown away by your response to our meme contest and realized we have a community full of talented creators! Let’s make HEXN go viral! 🫵Tap THIS & 🔼 Share, so more people can participate! *️⃣App | 💬Chats | *️⃣Website | 𝕏 Twitter

Hashtags

HEXN.IO Channel

@hexnio · Post #162 · 09.02.2023 г., 06:36

We are happy to Announce the #HEXN Meme Contest #Winners! Congratulations #Winners (Twitter Handles)👇! @ScaredHulk @cryingrnf @dionysuz_ @odukunelson @uonyekiss @crypto0harry @greymegawin @wangshuthian @mr_h_kumawat @BOSSSMUDA9 You have won 10$ per each winner. You will receive your reward on the platform 🏆🎉 🎉 Send us a DM with your Registered Email on #HEXN to claim your rewards! DM @MaxAttacker or our Twitter @hexn_io If your weren't chosen this time around, don't worry! We love memes, so there's more contests on the way. https://twitter.com/hexn_io/status/1623563743123902465