А знаете ли вы, что в 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
#Andijan
Over the past 10 days, shepherds have brought a herd of horses and sheep onto the lands of the “Green View” farm, destroying years of tree seedlings grown on the hills of Asaka District, Andijan region. In addition, the drip irrigation systems were damaged and rendered unusable.
The farmers repeatedly warned the shepherds, recorded the situation on video, and appealed to the internal affairs authorities, but no action was taken. As a result, the shepherds continue to graze their animals on the farm’s land.
The farmer suffered from back pain for more than a week and, after recording the damage on video and contacting the 102 hotline, still received no response or action from the authorities.
The farmers ask:
Why is their labor not protected?
Why is there no accountability for violations of the law?
Who protects the work done to turn desert lands into green areas?
They request that the Ministry of Internal Affairs of the Republic of Uzbekistan pay attention to this situation and ensure justice is served within the framework of the law. ☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot
Instagram | Facebook | Twitter | Sayt | Youtube.
#Andijan The treatment of birds by staff at the Andijan Zoo has raised serious concerns. This raises an important question: do we need private zoos?
The greatest risk is cruelty towards animals. In many cases, the pursuit of profit is placed above the peace and well-being of animals.
☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot
Instagram | Facebook | Twitter | Sayt | Youtube.
❓ Ingliz tilida e’tiroz bildirishingiz kerak…
Lekin qo‘pol chiqib qolishni xohlamaysiz? 👀
Bugungi mini-viktorinada aynan shuni mashq qilamiz!
Qaysi variant madaniyatli va to‘g‘ri?👇
🅰️ I’m not agreeing with that
🅱️ I beg to differ
🆑 I don’t think so, and you’re wrong
💬 Javobingizni kommentariyada yozing!
To‘g‘ri javob va tushuntirish — videoda! 🎥
📌 Boshqa foydali iboralarni o‘rganmoqchimisiz? Obuna bo‘ling va bizni kuzatib boring!
📞 Aloqa uchun:
📱 +998742261078 / +998994314134
📨 Telegram: @admofadc
#adcenglish#ingliztili#englishquiz#andijan
Senga yana nima yetmaydi?
Xattoki,baxt yelib-tolmoqlik.
Hammaga ham nasib etmaydi,
Tongda turib,nafas olmoqlik...
#spring#nature#Andijan#pomegranate_flowers
@madinaazam
🇺🇿Поздравляем всех вас с одним из главных праздников нашей страны – «8 декабря — День Конституции Республики Узбекистан».
Желаем всем Вам и Вашим близким крепкого здоровья, семейного благополучия, успехов в Вашей профессиональной деятельности и удачи во всех благих начинаниях!
#adceducate#adc#andijan#tashkent#taraqqiyot#instagood#instagram#asaka#uzbekistan#adcteam#andijandevelopmentcenter#privateschool#спраздником#holiday
Telegram Instagram FacebookTikTokYoutube