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

Резултати

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

Пребарај: #textpost

当前筛选 #textpost清除筛选
цикорiй

@tsukassadrive · Post #1626 · 20.05.2024 г., 07:42

#random#textpost#meme#original I heard you is a doomer, nigga. The world cherishes you, nigga. The world is still when you out of hustle and bustle of the human discourse, nigga. This stillness is boundless, nigga. This stillness makes life worth living, nigga. The world is indeed filled with despair and pain, nigga, but as to counter it, the world is filled with the wonder you can't even imagine, nigga. But don't go filtering out your ordinary life for them life's highs and lows, nigga. Just as you read this text, in this most ordinary moment, you don't experience any of your life's problems, nigga. You have time to read this pasta on the internet, nigga, so don't give in to your thought-autopilot and regain control of your life that is right now, nigga, not in the not-yet existing future or the past that only was, nigga.

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5894 · 29.11.2024 г., 09:04

Dost ko v Lana chahiye tha 🌚 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5888 · 28.11.2024 г., 16:45

Chaliye swarg se ghum kr aate h 😂🤡 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5543 · 24.10.2024 г., 13:23

Bolo n chup kahe ho 😆✊🏻 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting