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
@MaxDeleteAll_Bot
Qué puede hacer este bot?
Este bot te ayuda a eliminar gran cantidad de mensajes en tus grupos o canales
use use /delall si desea que se eliminen todos los mensajes
use use /delfrom (punto inicial) & /delto (punto final) antes de usar /delsel si desea eliminar esos & todos los mensajes posteriores.
Idioma: Inglés
(visto en @BotsGram_cu)
#delete
Fast FB Delete Tool
by marcelja
Fast Facebook Activity Deletion
This program can be used to clean up a facebook account without deleting the entire account.
https://github.com/marcelja/facebook-delete
#fb#facebok#delete
Redact
Allows you to automatically clean up your old posts from services like Twitter, Reddit, Facebook, Discord and more all in one place
https://redact.dev
#redact#delete#fb#twitter#reddit
@MassActionBot
Qué puede hacer este bot?
Este bot puede realizar múltiples acciones en tu Chat. ¿Cuál? Ahí lo tienes.:
- Eliminar todos los mensajes
- Kick all
- Ban all
- Silencio todo
- Unban all
- Activar todo
Idioma: Inglés
(visto en @BotsGram_cu)
#chanel, #groups, #delete, #ban, #kick, #mute
@daysandbox_bot
Qué puede hacer este bot?
Este bot elimina las publicaciones reenviadas y que contienen enlaces de los nuevos usuarios del grupo
(visto en @BotsGram_cu)
#gestión, #grupo, #chat, #unión, #bienvenido, #mute, #delete
@shiiinabot
Qué puede hacer este bot?
Un bot para eliminar automáticamente los mensajes no deseados predefinidos del grupo.
Idioma: Portugués
(visto en @BotsGram_cu)
#delete, #group, #notification, #message, #regex, #spam, #picture, #remove
@GitHubBot
Qué puede hacer este bot?
Este es un bot de GitHub. Puede notificarle sobre eventos en sus repositorios públicos de GitHub. También puede responder a tus mensajes para publicar comentarios en GitHub directamente desde Telegram.
Idioma: Inglés
(visto en @BotsGram_cu)
#telegram, #notify, #events, #github, #delete, #public, #command, #messages, #repository
@DeleteEventsBot
Qué puede hacer este bot?
Este bot elimina mensajes de eventos (también conocidos como mensajes de acción) en supergrupos.
Idioma: Inglés
(visto en @BotsGram_cu)
#delete, #service, #message, #spam, #helper, #group, #supergroup, #join, #left, #pinned