А знаете ли вы, что в 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
🇺🇿Biznes va tadbirkorlik oliy maktabi 9-may – Xotira va qadrlash kuni bilan barchangizni chin dildan qutlaydi!
🗓 9-may – Xotira va qadrlash kuni munosabati bilan Vatanimiz tinchligi va farovonligi uchun jang maydonlarida buyuk qahramonlik ko‘rsatib, halok bo‘lgan mo‘tabar ota-bobolarimizni xotirasi barhayot bo‘lsin, front ortida fidokorona mehnat qilgan faxriylarimizni hamda butun xalqimizni samimiy muborakbod etamiz!
⏩ O‘z navbatida, urushdan keyin mamlakatni tiklash, jonajon O‘zbekistonimizni rivojlantirishga munosib hissa qo‘shib kelayotgan, tabarruk yoshga yetib, duogo‘yimiz bo‘lib yurgan nuroniy otaxonu onaxonlarimizga cheksiz minnatdorligimizni bildiramiz.
🟥 Vatanimiz tinch, osmonimiz musaffo, mustaqilligimiz abadiy bo‘lsin aziz Yurtdoshlar!
#GraduateSchool#Remembrance#Appreciation
🌐Web-site |
✅ Telegram |
✅Facebook |
🌐Instagram
Standing in remembrance of those who gave their lives for freedom.
To remember is to refuse indifference, and to defend the dignity and freedoms they died for.
面對今日仇恨與極右思潮再次抬頭,自問若為自由犧牲的靈魂泉下有知,會如何期望我們守護得來不易的價值?
#Remembrance#LestWeForget#永誌不忘
US Condemns Crocus City Hall Terror Attack on Anniversary
The US Embassy in Russia marked the second anniversary of the Crocus City Hall tragedy, expressing solidarity with victims’ families. The March 22, 2024 terror attack claimed 151 lives, including children, profoundly affecting many. The US emphasized that the memory of those lost remains strong over time.
#terrorattack#Crocus#USA#Russia#remembrance
The main news of Russia and the world ishere.
前往 #和平紀念日 典禮的乘客
可取道 #中環 站 出口 J3 - 香港會所大廈
#中環 站出口位置 👉metroride.hk/3F89wcu
該站 出口 J1 - 終審法院 將於 11 月 10 日(星期日) 10:00 關閉至 12:00 為止,使進出街道的人流更為暢順 🌺
#LestWeForget
#英魂不朽#永誌不忘
Use Exit J3 - The Hong Kong Club Building for #Remembrance Day Ceremony
Exit locations of Central 👉metroride.hk/3F89wcu
While Exit J1 - The Court of Final Appeal will be closed from 10:00 - 12:00, 10/Nov (Sun) for a smoother passenger flow to and from street level 🌺
Musical and Poetic Performance “The Spring is Coming Again to the World…”
On the eve of Victory Day, the Russian House in Brussels invites you to a special evening of music and poetry.
People’s Artist of Russia Oleg Pogudin and his Romance Theatre will present a programme dedicated to the memory of a generation whose youth fell upon the years of the Great Patriotic War.
The evening will feature poems and songs born in the harsh years of war — sincere, courageous, and filled with both the pain of loss and a bright hope.
🎹 Piano part: Oleg Weinstein, Honored Artist of the Russian Federation
📅 April 28
🕖 19:00–21:00
📍 Russian House in Brussels
🎟 Free admission upon registration
https://rushouse.be/event/musical-performance-the-spring-is-coming-again-to-the-world/
We warmly invite you to join this evening of remembrance, music, and poetry.
#RussianHouseBrussels#BrusselsEvents#Culture#Music#Poetry#OlegPogudin#Concert#CulturalDiplomacy#VictoryDay#Remembrance#RussianCulture#ArtAndCulture