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
International Court of Justice (#ICJ ) has finally had enough of #Israelis and their #genocidal actions against the #Palestinians of Gaza
It has finally decided to do what #SouthAfrica demanded it should have done months ago:
• Demand that the #ZioNazis halt their #genocidal slaughter of innocents in #Gaza
and that
• Israel must ensure access to Gaza for UN genocide investigators
UN rapporteur: Israel will not stop ‘this madness’ until we make it stop
Francesca #Albanese, the #UN’s special #rapporteur on #Palestine on Saturday urged member states to impose sanctions on #Israel along with an arms embargo until it stops “this madness,”
“Let’s be clear. As the #ICJ orders Israel to stop its offensive in #Rafah, #Israel instead intensifies its attacks on it,”
The International Court of Justice (#ICJ) in its latest ruling ordered Israel to immediately halt its military offensive in #Rafah, a city in southern Gaza where more than 1.5 million displaced Palestinians had sought refuge.
“The news I am receiving from the people trapped therein are terrifying,
Be sure: Israel will not stop this madness until WE make it stop,”
Albanese urged all UN member states to impose #sanctions, arms #embargo and suspend diplomatic and political relations with Israel until it ceases its #genocidal assault.
A legal group submitted to the #UN the most thorough legal analysis of Israel's actions concluding it is committing genocide against Palestinians in Gaza.
This is probably the most complete report to date that demonstrates how #Israel's attacks on #Palestinians in #Gaza meet the legal definition of #genocide.
It's a 100-page report, by legal experts at #Boston University School of Law, #Cornell Law School, #Yale Law School, and others.
The report's conclusion:
"Israel has committed the #genocidal acts of #killing, causing serious harm to, and inflicting conditions of life calculated to bring about the physical #destruction of #Palestinians in #Gaza, a protected group that forms a substantial part of the Palestinian people.
These #genocidal acts have been motivated by the requisite genocidal intent, as evidenced in this report by the statements of #Israeli leaders, the character of the State and its forces’ conduct against and relating to Palestinians in Gaza, and the direct nexus between them."