А знаете ли вы, что в 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
#Greenland🇬🇱
Eternal ice 🧊 Would you like to visit here?
About 80% of the territory of Greenland is covered with an ice shield, which is the second largest in the world after Antarctica. The ice in some places reaches a thickness of up to 3 km.
Greenland cuisine is based on the gifts of nature: fish, seafood, venison and dishes from marine mammals. For example, "Suasat" - sewen soup - is considered a traditional dish.
Отвлечемся на секунду от новостей автопрома и поговорим чуть о том, что в мире нет стабильности. Суматошный нестабильный эксцентричный президент США хочет заграбастать Гренландию.
В одном из своих интервью он сказал, что армия Гренландии состоит из двух собачьих упряжек. Гордые жители создали шедевральный ии-шный ролик (точно пару дней потратили) в котором продемонстрировали свои военные возможности. У них есть собаки, моржи и пингвины (почему-то в форме образца СССР).
Что мы вообще думаем об этой ситуации. Заберет или не заберет?
Заберет - 👎
Не заберет - 👍
Вообще это какая то дичь - 🥴
Ролик огонь - ❤️
#greenland
#GREENLAND RESULT
—————————
PEAK: 1,109%
If you think that was a great move, you haven't seen what we have planned for our next launch...
After giving it to you guys, we pushed #GREENLAND over 1,100% in a matter of less than an hour, destroying our target and guaranteeing the biggest profits for our members.
Trump is about to move the global economy again, and we're about to have the biggest 100x opportunity we've had in years. We're just getting started
Stay tuned.
👣 The iceberg's breath in northeast
Greenland. Silence and icy expanses where every breath feels like nature itself.
📏
📏
📏
📏
📏
📏
📏
📏
#Greenland | @voyage
👣 The iceberg's breath in northeast Greenland. Silence and icy expanses where every breath feels like nature itself.
📏
📏
📏
📏
📏
📏
📏
📏
#Greenland🇬🇱@voyage
#GREENLAND RESULT
—————————
PEAK: 1,109%
If you think that was a great move, you haven't seen what we have planned for our next launch...
After giving it to you guys, we pushed #GREENLAND over 1,100% destroying our target and guaranteeing the biggest profits for our members.
Trump is about to move the global economy again, and we're about to have the biggest 100x opportunity we've had in years. We're just getting started
Stay tuned.
👣 The iceberg's breath in northeast Greenland. Silence and icy expanses where every breath feels like nature itself.
📏
📏
📏
📏
📏
📏
📏
📏
#Greenland🇬🇱@voyage
The United States abandoned the idea of seizing Greenland due to the threat of impeachment to Trump, - Reuters
#Trump#Greenland
👂More on Trump's Ear ⚠️
The world would be a “better, more secure place” if America took over Greenland, Nigel Farage said at Davos, while insisting that he still believed in the sovereignty of nation states.
During a panel at the World Economic Forum’s “America House” in the Swiss ski resort on Wednesday, the Reform UK leader said he had “no doubt” that the world would be safer if a “strong America” was in Greenland “because of the geopolitics of the high north, because of the retreating ice caps and because of the continued expansionism of Russian icebreakers, of Chinese investmen
#Trump#Greenland
👂More on Trump's Ear ⚠️
The United States needs Greenland for national security reasons, Trump said.
According to the US president, the island is important for the creation of the Golden dome system. And NATO is supposed to pave the way for America to get Greenland.
#Trump#Greenland
👂More on Trump's Ear ⚠️