А знаете ли вы, что в 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
Title : "The Mysterious Nightmare"
The nightmare I got a day before,
Was full of science and plenty more,
The world of progress that we think of tonight,
The robots were working, it was a dreadful night.
It was when the human were servants,
Robots were having bungalows or villas,
We were that time the only vagrants.
The humans were robots and the robots were humans,
They all were having parties and we were being summoned.
They were instructing us as if we were dolls,
But the reality was that it was they robotic dolls.
They were the ones we then pray to God,
The one who takes our ease and comfort and many more.
Suddenly, with a jerk of dream, I saw someone with spiritual rays,
I was unable to see the face but was feeling the sense of gaze.
The voice says," Oh my dear child, calm your mind and enjoy the note of nature".
I then opened my eyes to the end of this dreamy adventure.
In the morning dawn,
With the closet of bizarre dreams and an upset mind,
I woke up on the verge of a melancholic night.
Suddenly, I heard the crazy cries of birds,
It was so blissful that I can't express it within a few words.
Enjoying the subtlety of nature,
I realised the existence of each creature.
Praying to God I would never have such dream,
I started my routine work with an energising scream.
#review
#Cookie
#Nightmare
"Goodnight" and then I sleep. I spent the day with you and I plan on continuing so I keep you in my dreams. It feels magical. Almost surreal. This is what I've longed for. Even after you broke me, you never left my mind. Except this time you were a nightmare, not a dream
#review#nightmare#her#broken
Mi sono stancato di influencer e tiktoker vari, buoni solo a pietrificare l'attenzione verso cose futili.
#vaporonda#vaporwave#vapourwave#vaporart#seapunk#webpunk#glitch#glitchart#glitchartistscollective#chillwave#aesthetic#vaporwaveaesthetic#vaporwaveaesthetics#malinconia#melancholy#tristezza#sadness#sadboy#lofi#apparenza#appearance#appearance#illusione#illusion#incubo#nightmare