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
📰 AerynOS Gets New Branding and Updated Desktop Stacks
AerynOS 2026.05 arrives with refreshed branding, GNOME 50.1, KDE Plasma 6.6.4, COSMIC 1.0.11, and Linux kernel 7.0.2.
🔗 Source: https://linuxiac.com/aerynos-gets-new-branding-and-updated-desktop-stacks/
#gnome#kde#kernel#linux#plasma
📰 AerynOS March 2026 Update Brings GNOME 50, KDE 6.6.3, and Linux 6.18
AerynOS March alpha ISO brings GNOME 50, KDE Plasma 6.6.3, Linux kernel 6.18, and tooling improvements across moss and boulder.
🔗 Source: https://linuxiac.com/aerynos-march-2026-update-brings-gnome-50-kde-6-6-3-and-linux-6-18/
#kde#linux#kernel#plasma#gnome
📰 Slackware-Based PorteuX 2.6 Released with Linux 6.19, TLP Support, and More
PorteuX 2.6 Linux distribution is now available for download with Linux kernel 6.19, GNOME 49.4, KDE Plasma 6.5.5, Cinnamon 6.6, and more. Here’s what else is new!
🔗 Source: https://9to5linux.com/slackware-based-porteux-2-6-released-with-linux-6-19-tlp-support-and-more
#linux#gnome#kde#plasma#kernel
📰 Linux 7.0 Release, Age Verification Laws, Ryzen 9 9950X3D2 & Other April Happenings
A lot happened in the Linux and open-source world during the month of April. Ubuntu 26.04 LTS and Fedora 44 shipped, a lot of news around age attestation/verification laws, the Linux 7.0 kernel was released, Linux 7.1 is bringing many exciting changes as well as removing of old hardware drivers, the Ryzen 9 9950X3D2 Dual Edition CPU was released, we began testing the Intel Arc Pro B70 "BMG-G31", and much more software and hardware content that...
🔗 Source: https://www.phoronix.com/news/April-2026-Highlights
#fedora#intel#kernel#linux#opensource#ubuntu
📰 BunsenLabs Carbon Is Here with Support for Wayland Sessions, Based on Debian 13
BunsenLabs Carbon Linux distribution is now available for download with support for Wayland session, based on Debian GNU/Linux 13 "Trixie". Here's what's new!
🔗 Source: https://9to5linux.com/bunsenlabs-carbon-is-here-with-support-for-wayland-sessions-based-on-debian-13
#linux#debian#gnu#wayland
📰 Calamares Linux Graphical Installer Now Supports KDE’s Plasma Login Manager
Calamares 3.4.2 open-source universal graphical installer for GNU/Linux distributions is now available for download with support for Plasma Login Manager. Here’s what’s new!
🔗 Source: https://9to5linux.com/calamares-linux-graphical-installer-now-supports-kdes-plasma-login-manager
#plasma#gnu#kde#linux#opensource
#qml#dotfiles#hyprland#linux#material_design#quickshell#rice#ricing#unixporn#wayland
This Hyprland dotfiles setup gives you a modern, easy-to-use Linux desktop with features like a live app overview, AI integration (Gemini and Ollama), and automatic, beautiful color themes that match your wallpaper. Installation is simple with a one-line command, and the default keybinds are familiar if you’ve used Windows or GNOME. The system uses Quickshell for widgets (not Waybar), shows every command during setup for transparency, and offers a friendly Discord community for help. You benefit from a polished, customizable environment that’s both visually appealing and practical, with support for new users and advanced customization options.
https://github.com/end-4/dots-hyprland
📰antiX 26 Released as Systemd-Free Debian 13 Distro with Five Init Systems
antiX Linux 26 arrives based on Debian 13 Trixie with five init systems, a systemd-free design, and a fast, lightweight environment built for efficiency.
🔗 Source: https://linuxiac.com/antix-26-released-as-systemd-free-debian-13-distro-with-five-init-systems/
#debian#systemd#linux#distro
📰 Budgie 10.10.2 Brings Improved Labwc Wayland Compositor Integration
Out today is Budgie 10.10.2 as the latest minor update to this open-source desktop environment that began as part of the Solus Linux project...
🔗 Source: https://www.phoronix.com/news/Budgie-10.10.2-Released
#wayland#budgie#opensource#linux
#shell#arch#bash#discord#dpi#goodbyedpi#linux#nfqws#nftables#ubuntu#youtube#zapret
This Linux script (tested on Ubuntu 24.04 and Arch) easily sets up Zapret to bypass YouTube slowdowns and Discord blocks using Flowseal configs. Clone the repo, run `sudo bash main_script.sh` to pick a strategy (like general.bat), network interface, and save settings in conf.env for quick non-interactive launches or auto-start via `sudo bash service.sh`. It uses nftables, cleans up on stop, and skips auto-updates to stay stable. You get fast, reliable access to YouTube videos and Discord chats without hassle.
https://github.com/Sergeydigl3/zapret-discord-youtube-linux