@doniyorieltss · Post #2131 · 30.08.2024 г., 14:35
When you dream up your perfect life, you think about how you're seen, rather than what your daily tasks include 101 essays that will change the way you think #insights
Hashtags
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
Пребарај: #insights
@doniyorieltss · Post #2131 · 30.08.2024 г., 14:35
When you dream up your perfect life, you think about how you're seen, rather than what your daily tasks include 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2130 · 29.08.2024 г., 14:35
You are more in love with ideas than you are with work and processes required to make them reality 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2126 · 28.08.2024 г., 14:35
If you don't know what to do, you don't know what's wrong. If you don't know what's wrong, it is because some part of you is resisting seeing it 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2125 · 19.08.2024 г., 14:36
Clarity comes from doing, not thinking about doing 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2124 · 18.08.2024 г., 14:35
The best things will not make sense - not initially, at least 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2123 · 17.08.2024 г., 14:35
To fully accept your life - the highs, lows, good, bad - is to be grateful for all of it, and to know that the "good" teaches you well, but the "bad" teaches you better 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2122 · 16.08.2024 г., 14:34
Sometimes the way light enters us is, in fact, through the wound 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2121 · 15.08.2024 г., 14:34
What you learn and who you become is more important than how you temporarily feel 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2120 · 14.08.2024 г., 14:34
The people who were able to hurt you most were also the people whom you were able to love the most 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2118 · 13.08.2024 г., 14:36
The road to hell was paved with good intentions 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2117 · 12.08.2024 г., 14:44
Defensiveness is born of fear; assertiveness is born of confidence 101 essays that will change the way you think #insights
Hashtags
@doniyorieltss · Post #2116 · 11.08.2024 г., 14:34
Life isn't about being "certain", it's about trying anyway 101 essays that will change the way you think #insights
Hashtags