@LeagueOfLegendsLatamSur · Post #2619 · 25.02.2021 г., 19:54
#Sad
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
Пребарај: #sad
@LeagueOfLegendsLatamSur · Post #2619 · 25.02.2021 г., 19:54
#Sad
Hashtags
@ukraine_war_truth · Post #44 · 24.11.2024 г., 02:20
Ukraine has 2-7 trillion dollars of minerals that the US wants to get its hands on. Remember how at the beginning of the war Western propaganda claimed this was some righteous fight for democracy, lol? Light VS dark struggle? Well, no one is even pretending anymore - its all about the Benjamins. And if Western politicians and American and global corporations that have made hundreds of billion off of this suffering always knew that, it might be a surprise to some good-hearted people in the West who believed those lies. Show this clip to them, please. I also found a version with Ukrainian subtitles. If you have any friends from there, forward it to them too, please. So that they know what almost a million of their sons, fathers and husbands have died for - so that America can exploit their country for generations to come... #sad. Very, very sad, as the future president likes to say... Please subscribe to our channel - help share the Ukraine War Truth! Peace!
Hashtags
@Lash_gif · Post #40908 · 15.08.2023 г., 19:23
#girl | #sad clb: #other
@Lash_gif · Post #35410 · 09.01.2023 г., 16:18
#girl | #sad Clb: #other
@Lash_gif · Post #34813 · 26.11.2022 г., 07:54
#girl | #sad Clb: #other
@Lash_gif · Post #34722 · 19.11.2022 г., 07:35
#girl | #sad Clb: #other
@Lash_gif · Post #43260 · 16.01.2024 г., 02:59
#boy | #sad Clb: #other
@Lash_gif · Post #41283 · 31.08.2023 г., 17:44
#boy | #sad Clb: #other
@Lash_gif · Post #41126 · 22.08.2023 г., 11:49
#boy | #sad Clb: #other
@Lash_gif · Post #39644 · 30.06.2023 г., 08:32
#boy | #sad Clb: #other
@Lash_gif · Post #39577 · 27.06.2023 г., 07:06
#boy | #sad Clb: #other
@Lash_gif · Post #39486 · 23.06.2023 г., 06:52
#boy | #sad Clb: #other