А знаете ли вы, что в 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
🕊November 7: The Woman Who Said “No” to Apartheid
🇿🇦🗓 November 7 marks the birthday of Helen Suzman (née Gavronsky; 1917–2009) — a South African activist and politician who bravely stood against apartheid.
She was the only member of Parliament to consistently and unequivocally oppose all apartheid legislation.
Suzman played a crucial role in improving prison conditions for members of the banned African National Congress (ANC), including Nelson Mandela, and she used her parliamentary privilege to bypass government censorship and share reports on the worst abuses of apartheid.
She was nominated twice for the Nobel Peace Prize. 🕊
💬Quotes by Helen Suzman:
• “I was the only one who said ‘no’ to apartheid, but that was no reason to keep quiet.”
• “It is not my questions that embarrass South Africa—it is your answers.”
(Addressed to the apartheid government during her time in Parliament.)
• “The test of civilization is the way that it cares for its helpless members.”
📸 Photo: Wikipedia
#SouthAfrica#History#HumanRights#AntiApartheid#Mandela
🗓 June 18 – Thabo Mbeki turns 83
On this day in 1942, Thabo Mvuyelwa Mbeki, the second President of South Africa (1999–2008) after Nelson Mandela, was born. As a young man, he studied in the Soviet Union and played a key role in the anti-apartheid movement.
🎓 Mbeki has long emphasized the power of education in transforming Africa. Here are some of his most compelling quotes:
💬 “We must prioritize education and invest in our young people. They are the future leaders and the driving force of our continent's development.”
💬 “Education is the key to unlocking the potential of our people. It’s the tool that will help us overcome challenges and build a brighter future.”
💬 “Education is not just about acquiring knowledge. It’s about developing critical thinking and a lifelong thirst for learning.”
#Education#Mbeki#Birthday#SouthAfrica#Mandela
🗓🎉October 7 — Birthday of Archbishop Desmond Tutu (1931–2021)
A fearless anti-apartheid activist, theologian, and the first Black South African Anglican bishop, Desmond Tutu received the Nobel Peace Prize in 1984 for his unwavering fight for justice and equality. ✝️✨
🕊🇿🇦 After South Africa’s first democratic elections in 1994, President Nelson Mandela appointed him to chair the Truth and Reconciliation Commission (TRC) — a crucial step toward national healing after decades of apartheid.
💬Quotes by Desmond Tutu:
• “If you want peace, you don’t talk to your friends. You talk to your enemies.”
• “Hope is being able to see that there is light despite all of the darkness.”
• “Without forgiveness, there is no future.”
• “If you are neutral in situations of injustice, you have chosen the side of the oppressor.”
• “Children are a wonderful gift. They have an extraordinary capacity to see into the heart of things and to expose sham and humbug for what they are.”
#DesmondTutu#SouthAfrica#History#NobelPeacePrize#HumanRights#Mandela
🇿🇦 The Office of the Honorary Consul of South Africa met with Tatyana Mohamed — a Yekaterinburg native who has lived in South Africa for more than 30 years. 🌍✨
📸 Her husband is a renowned photographer who used to work with Nelson Mandela.
During the meeting, we shared insights about the activities of the Honorary Consul, Sergey Mazurkevich, and discussed opportunities for future cooperation and potential joint projects. 🤝
#SouthAfrica#Yekaterinburg#Diplomacy#Cooperation#Culture#Mandela#Photography#HonoraryConsul
NELSON MANDELA STATUE IN PRETORIA
🕊 The nine-meter statue of Nelson Mandela stands on the grounds of the Union Buildings in Pretoria.
🗓 It was officially unveiled on December 16, 2013, one day after the end of South Africa’s 10-day national mourning period, which followed Mandela’s passing on 5 December.
📍 The unveiling took place on Reconciliation Day, a symbolic moment marking a new chapter in the nation’s journey.
With outstretched arms, the statue represents unity, reconciliation, and the spirit of Ubuntu — values Mandela championed throughout his life.
More on Ubuntu in an upcoming post.
#SouthAfrica#Mandela#Pretoria#UnionBuildings#Ubuntu#MandelaLegacy#ReconciliationDay#History#Architecture