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

Резултати

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

Пребарај: #arch

当前筛选 #arch清除筛选
Linuxgram 🐧

@linuxgram · Post #17914 · 27.02.2026 г., 07:39

📰 Arch-Based Omarchy 3.4 Released With Tmux Integration, Hibernation by Default Arch-based Omarchy 3.4 introduces default Tmux integration, hibernation on new installs, refined Hyprland workflows, and multiple new desktop themes. 🔗 Source: https://linuxiac.com/arch-based-omarchy-linux-3-4-released/ #arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18648 · 01.05.2026 г., 21:34

📰 Shelly 2.2 Arch Linux GUI Package Manager Released with Major UI Revamp Shelly 2.2 graphical package manager for Arch Linux systems is now available for download with a revamped UI and various other improvements. Here's what's new! 🔗 Source: https://9to5linux.com/shelly-2-2-arch-linux-gui-package-manager-released-with-major-ui-revamp #arch#linux

Hashtags

Linuxgram 🐧

@linuxgram · Post #18578 · 26.04.2026 г., 21:46

📰CachyOS Introduces New Default GUI Package Manager, Kyber For NVMe I/O Scheduler The April 2026 ISO refresh of the Arch Linux based CachyOS is now available with a variety of refinements, new hardware support, and other polishing... 🔗 Source: https://www.phoronix.com/news/CachyOS-April-2026 #arch#linux

Hashtags

Linuxgram 🐧

@linuxgram · Post #18503 · 21.04.2026 г., 05:23

📰 Archinstall 4.3 Arch Linux Installer Adds Support for Installing Additional Fonts Archinstall 4.3 text-mode installer for the Arch Linux distribution is now available with support for installing additional fonts, as well as other changes and bug fixes. 🔗 Source: https://9to5linux.com/archinstall-4-3-arch-linux-installer-adds-support-for-installing-additional-fonts #arch#linux

Hashtags

Linuxgram 🐧

@linuxgram · Post #18398 · 11.04.2026 г., 20:22

📰 First Look at Shelly, a Modern Graphical Package Manager for Arch Linux Meet Shelly, a new package management tool for Arch Linux that aims to be more intuitive and user-friendly than what’s already on the market. 🔗 Source: https://9to5linux.com/first-look-at-shelly-a-modern-graphical-package-manager-for-arch-linux #arch#linux

Hashtags

Linuxgram 🐧

@linuxgram · Post #18320 · 06.04.2026 г., 09:15

📰 Arch Linux Makes nft the Default Backend for iptables Arch Linux developers have announced that iptables now defaults to the nft backend, replacing the previous iptables-nft package name. 🔗 Source: https://linuxiac.com/arch-linux-makes-nft-the-default-backend-for-iptables/ #linux#arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18249 · 31.03.2026 г., 01:07

📰 Archinstall 4.0 Arch Linux Installer Released with New Textual UI Archinstall 4.0 Arch Linux menu-based installer is now available for download with a new TUI (text-based user interface), new features, and various improvements. 🔗 Source: https://9to5linux.com/archinstall-4-0-arch-linux-installer-released-with-new-textual-ui #linux#arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18205 · 26.03.2026 г., 20:43

📰 CachyOS just dethroned Arch Linux on ProtonDB, and Linux gamers are finally noticing It was inevitable once you see everything CachyOS has. 🔗 Source: https://www.xda-developers.com/cachyos-is-the-new-king-of-protondb/ #linux#arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18179 · 25.03.2026 г., 14:05

📰 Garuda Linux Draws a Line on Age Verification as Arch Stays Keeps Mum Garuda has taken an official stance on the age verification question, while Arch Linux is silent. 🔗 Source: https://feed.itsfoss.com/link/24361/17305810/garuda-linux-age-verification #linux#arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18089 · 17.03.2026 г., 13:46

📰 EndeavourOS Titan released, devs comment on age verification laws The Arch-based Linux distribution EndeavourOS Titan is out now, bringing with it plenty of nice sounding upgrades and some comments on age verification.Read the full article on GamingOnLinux. 🔗 Source: https://www.gamingonlinux.com/2026/03/endeavouros-titan-released-devs-comment-on-age-verification-laws/ #linux#arch

Hashtags

Linuxgram 🐧

@linuxgram · Post #18075 · 16.03.2026 г., 13:19

📰 Manjaro Linux looks like it's in trouble with the release of the "Manjaro 2.0 Manifesto" At one point it seemed like Manjaro Linux would be the most popular Arch-based distribution, but after many missteps it appears to be at breaking point.Read the full article on GamingOnLinux. 🔗 Source: https://www.gamingonlinux.com/2026/03/manjaro-linux-looks-like-its-in-trouble-with-the-release-of-the-manjaro-2-0-manifesto/ #arch#linux

Hashtags

Linuxgram 🐧

@linuxgram · Post #18544 · 23.04.2026 г., 15:23

📰 Arch-Based Omarchy 3.6 Improves Panther Lake Efficiency Omarchy 3.6 introduces Panther Lake kernel patches, persistent Hyprland toggles, and improved laptop display management. 🔗 Source: https://linuxiac.com/arch-based-omarchy-3-6-improves-panther-lake-efficiency/ #arch#kernel

Hashtags

ПретходнаСтраница 1 од 3Следна