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

Резултати

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

Пребарај: #appimages

当前筛选 #appimages清除筛选
Libreware

@libreware · Post #1543 · 12.02.2026 г., 05:10

AppManager GTK/Libadwaita developed desktop utility in Vala that makes installing and uninstalling #AppImages on #Linux desktop painless. It supports both SquashFS and DwarFS AppImage formats, features a seamless background auto-update process, and leverages zsync delta updates for efficient bandwidth usage. Double-click any .AppImage to open a macOS-style drag-and-drop window, just drag to install and AppManager will move the app, wire up desktop entries, and copy icons. Features Drag-and-drop installer: Mimics the familiar macOS Applications install flow. Smart install modes: Can choose between portable (move the AppImage) and extracted (unpack to ~/Applications/.installed/AppRun) while letting you override it. Desktop integration: Extracts the bundled .desktop file via 7z or dwarfs, rewrites Exec and Icon, and stores it in ~/.local/share/applications. Simple uninstall: Right click in app drawer and choose Move to Trash, can uninstall in AppManager or simply delete from ~/Applications folder. Install registry + preferences: Main window lists installed apps, default mode, and cleanup behaviors, all stored with GSettings. Background app updates: Optional automatic update checks with configurable interval (daily, weekly, monthly) and notifications when updates are found. Your Linux AppImages don't need to be disorganized. https://itsfoss.com/appmanager/ https://github.com/kem-a/AppManager/releases