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,454 слични објави

Глобално пребарување

Linuxgram 🐧

@linuxgram · Post #18741 · 11.05.2026 г., 09:23

📰 Linux is Getting a Kill Switch! This AI-assisted patch would let admins disable vulnerable kernel functions until a proper fix ships. 🔗 Source: https://feed.itsfoss.com/link/24361/17338173/linux-killswitch-proposal #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18712 · 08.05.2026 г., 15:57

📰 Linux Kernel Dirty Frag LPE Exploit Enables Root Access Across Major Distributions Details have emerged about a new, unpatched local privilege escalation (LPE) vulnerability impacting the Linux kernel.Dubbed Dirty Frag, it has been described as a successor to Copy Fail (CVE-2026-31431, CVSS score: 7.8), a recently disclosed LPE flaw impacting the Linux kernel that has since come under active exploitation in the wild. The vulnerability was reported to Linux kernel maintainers. 🔗 Source: https://thehackernews.com/2026/05/linux-kernel-dirty-frag-lpe-exploit.html #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18711 · 08.05.2026 г., 13:24

📰 Linux 7.2 To Support Realtek RTL8159 10GbE USB Ethernet The Realtek RTL8159 has been appearing in some 10G-rated USB network adapters at online retailers, some for less than $100 USD. But currently the RTL8159 is only supported by Realtek's out-of-tree Linux kernel driver, but fortunately there will be mainline support coming with the Linux 7.2 kernel this summer... 🔗 Source: https://www.phoronix.com/news/Realtek-RTL8159-Linux-7.2 #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18702 · 07.05.2026 г., 14:58

📰 Flattened Image Tree 1.0 Specification For Embedded Linux Systems The Flattened Image Tree "FIT" 1.0 specification was recently finalized for this container format used by U-Boot on embedded systems for providing various boot components like DTBs, the Linux kernel image, and more into a single file... 🔗 Source: https://www.phoronix.com/news/Flat-Image-Tree-1.0 #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18679 · 05.05.2026 г., 19:33

📰 Attackers are cashing in on fresh 'CopyFail' Linux flaw Researchers dropped a reliable root exploit and it didn’t sit idle for long CISA is warning that a newly-disclosed Linux kernel bug dubbed "CopyFail" is already being exploited, just days after researchers dropped a working root-level exploit.… 🔗 Source: https://go.theregister.com/feed/www.theregister.com/2026/05/05/cisa_sounds_the_alarm_on/ #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18666 · 04.05.2026 г., 11:05

📰 Linux File-System Proliferation A Burden: Requirements Laid Out For Any Future File-Systems The growing number of file-systems within the Linux kernel source tree is causing an ongoing burden for upstream developers maintaining the virtual file-system (VFS) code around it and associated code. As a result of the continuing rise of new file-systems being proposed for the Linux kernel, documentation is being introduced to establish clear guidelines for getting new file-systems accepted into the mainline kernel... 🔗 Source: https://www.phoronix.com/news/Linux-FS-Proliferation-Burden #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18662 · 03.05.2026 г., 11:09

📰 Turtle Beach WaveFront ISA Sound Cards Seeing Suspend/Resume Support On Linux In 2026 It's been an interesting 2026 in Linux development with beginning to phase out i486 CPU support, dropping ISDN and amateur "ham" radio support, and other code cleaning in the name of a diminishing user base -- or perhaps even no users left -- for those running such vintage hardware with a modern, up-to-date kernel. Yet ISA sound card drivers have seen an uptick in activity... 🔗 Source: https://www.phoronix.com/news/Turtle-Beach-WaveFront-SnR #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18643 · 01.05.2026 г., 12:33

📰 Linux 7.2 To Set Default DRM Scheduler Priority To "Fair", New AIE4 Hardware In AMDXDNA Even while the Linux 7.1 merge window was still ongoing this month, the initial "drm-misc-next" pull request to DRM-Next was sent out for beginning to queue new feature material toward the Linux 7.2 kernel coming this summer... 🔗 Source: https://www.phoronix.com/news/Linux-7.2-Initial-DRM-Misc-Next #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18637 · 01.05.2026 г., 05:02

📰 Linux Mint To Begin Publishing HWE ISOs For Better Hardware Support Due to Linux Mint moving to a longer development cycle with their next release not due until December, Linux Mint developers have decided to begin regularly publishing hardware enablement "HWE" ISOs with newer Linux kernel versions to provide better support for new hardware... 🔗 Source: https://www.phoronix.com/news/Linux-Mint-HWE-ISOs #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18633 · 30.04.2026 г., 19:32

📰 AerynOS Updated With Linux 7.0, Gaming Optimized Kernel Flavor AerynOS, the Linux distribution formerly known as Serpent OS, is out with a new monthly ISO refresh and details on other recent improvements to this original, from-scratch Linux distribution... 🔗 Source: https://www.phoronix.com/news/AerynOS-April-2026-Update #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18616 · 29.04.2026 г., 14:35

📰 Linux Kernel 6.19 Reaches End of Life: Time to Move Forward by George WhittakerThe Linux kernel continues its fast-paced release cycle, and with that comes an important milestone: Linux kernel 6.19 has officially reached end of life (EOL). For users and distributions still running this branch, it’s now time to upgrade to a newer kernel version.This isn’t unexpected, Linux 6. 🔗 Source: https://www.linuxjournal.com/content/linux-kernel-619-reaches-end-life-time-move-forward #kernel#linux

Linuxgram 🐧

@linuxgram · Post #18579 · 26.04.2026 г., 22:22

📰Linus Torvalds Announces First Linux Kernel 7.1 Release Candidate Linus Torvalds announced the general availability of the first Release Candidate version of the upcoming Linux 7.1 kernel series for public testing. Here’s what to expect! 🔗 Source: https://9to5linux.com/linus-torvalds-announces-first-linux-kernel-7-1-release-candidate #kernel#linux

12•••5051525354•••100•••121122
ПретходнаСтраница 52 од 122Следна