А знаете ли вы, что в Bash есть особая переменная "$_" ? Из описания можно узнать, что в переменную "$_" помещается последний аргумент последней команды.
Что-то знакомое? Конечно, в Python есть примерно тоже самое.
Мы знаем, что дата первого релиза Bash (8 июня 1989) несколько раньше чем первый релиз Python (20 февраля 1991). Если учесть, что по задумке автора Python это агрегация самых успешных практик отовсюду, можно ли сказать что именно эта фишка к нему пришла из Bash? Ни подтверждения ни опровержения я пока не нашел.
Давайте просто считать это совпадением 😉
А как это может быть полезно в Bash?
Приведу простой пример, который оценят те, кто часто работает в терминале.
Допустим, нам надо создать директорию и зайти в неё. Что обычно делаем?
:~$ mkdir foldername
:~$ cd foldername
:~/foldername$
Как это сделать в одну команду?
:~$ mkdir foldername && cd foldername
:~/foldername$
Уже лучше, но хочется короче, без повторов. Вот тут и пригодится наша переменная. Напомню, что в неё сохраняется последний аргумент предыдущей команды.
:~$ mkdir foldername && cd $_
:~/foldername$
_________________
PS.
Символы "&&"" разделяют команды и означают, что требуется выполнить вторую команду только если первая завершилась успешно.
#linux#tricks
📰 Troubleshooting "AppImages require FUSE to run" on Linux
AppImage complained of missing libfuse.so.2 even though fuse2 and fuse3 both were installed. Here's what I did to fix the issue.
🔗 Source: https://feed.itsfoss.com/link/24361/17306359/appimage-fuse-issue
#linux#appimage
📰openSUSE’s Agama Installer 19 Released with Major Architectural Overhaul
openSUSE's new Agama Linux installer v19 arrives with a redesigned core architecture, new API foundation, improved web UI, and more.
🔗 Source: https://linuxiac.com/opensuses-agama-installer-19-released-with-major-architectural-overhaul/
#opensuse#linux
📰 Libcamera 0.7.1 Released With Improved Software ISP
Libcamera 0.7.1 released on Tuesday as the newest feature release for this open-source library for camera image signal processors (ISPs) that has grown of importance for the likes of Raspberry Pi and Chrome OS and modern desktop Linux distributions with modern laptop hardware like recent Intel Core (Ultra) laptops...
🔗 Source: https://www.phoronix.com/news/libcamera-0.7.1-Released
#intel#linux#opensource#raspberry
📰 Intel's Vulkan Linux Driver Lands New Feature To Boost DX12 Game Performance
Intel's open-source "ANV" Vulkan driver for Linux systems enabled a new feature called BTP+BTI RCC Keying. You may be wondering what it means or stands for, but long story short it helps with the performance of Direct3D 12 (DX12) games running on Linux by way of Valve's Steam Play with Proton + VKD3D-Proton...
🔗 Source: https://www.phoronix.com/news/Intel-ANV-BTP-BTI-RCC-Keying
#steam#opensource#linux#intel
📰 EndeavourOS Titan Neo Is Out with KDE Plasma 6.6.4 and KDE Gear 26.04
EndeavourOS Titan Neo distribution is now available for download with the KDE Plasma 6.6.4 desktop environment, Linux kernel 6.19.12, and other changes. Here’s what’s new!
🔗 Source: https://9to5linux.com/endeavouros-titan-neo-is-out-with-kde-plasma-6-6-4-and-kde-gear-26-04
#kde#kernel#linux#plasma
📰 EndeavourOS Titan Released with Linux Kernel 6.19 and KDE Plasma 6.6
EndeavourOS Titan distribution is now available for download with Linux kernel 6.19, KDE Plasma 6.6, and other changes. Here’s what’s new!
🔗 Source: https://9to5linux.com/endeavouros-titan-released-with-linux-kernel-6-19-and-kde-plasma-6-6
#plasma#kde#kernel#linux
📰 I tried Fedora and learned why it's not the beginner Linux distro everyone assumes it is
Fedora is one of the best Linux distros out there, but if you're a beginner, it's probably not the best place to start.
🔗 Source: https://www.xda-developers.com/tried-fedora-learned-why-not-beginner-distro-everyone-assumes-it-is/
#distro#linux#fedora
📰 Fedora Project Leader Suggests Linux Distros Could Adopt Apple's Age Verification API
He thinks a cross-distro API standard can be a practical solution to tackle age verification.
🔗 Source: https://feed.itsfoss.com/link/24361/17306020/fedora-leader-suggests-age-verification-api
#fedora#linux#distro
📰 Fedora Pocketblue Remix is an atomic Linux distro for mobile devices (phones and tablets)
Fedora Pocketblue Remix is a mobile Linux distribution designed to let you run Fedora on a smartphone or tablet. But unlike most mobile Linux distros, Pocketblue is an atomic distro. In a nutshell, that means it’s an operating system that’s harder to break because of the way updates are installed. Basically, new package updates are .
🔗 Source: https://liliputing.com/fedora-pocketblue-remix-is-an-atomic-linux-distro-for-mobile-devices-phones-and-tablets/
#linux#fedora#distro
📰 Lilbits: Vertical tabs for Chrome, Mac OS 10 for the Nintendo Wii, and a CyberDeck Pi
The CyberDeck Pi is a DIY handheld computer that looks like something designed for a world where smartphones never existed. It’s a chunky device that probably won’t fit in your pocket. But it’s also a full-fledged computer that can run desktop GNU/Linux software thanks to its Raspberry Pi brains. And it’s made using a combination .
🔗 Source: https://liliputing.com/lilbits-vertical-tabs-for-chrome-mac-os-10-for-the-nintendo-wii-and-a-cyberdeck-pi/
#gnu#raspberry#linux