А знаете ли вы, что в 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
#SLP/USDT analysis :
#SLP is currently in a downtrend, forming lower lows (LLs) and lower highs (LHs) structure. The price is currently testing the resistance zone and the 200 EMA. A decline from this level is expected, with a potential test of the swing low level.
TF : 2h
Entry : $0.001740
Target : $0.001530
SL : $0.001847
#SLP/USDT analysis :
The #SLP is currently experiencing a downtrend, trading below its 200 Exponential Moving Average (EMA). The price has broken and retested the support zone, indicating a potential resumption of bearish momentum. The next target for the price will be the swing low level.
TF : 4h
Entry : $0.002105
Target : $0.001800
SL : $0.002290
#SLP/USDT analysis :
#SLP is currently in a bearish trend, marked by a consistent formation of lower lows (LLs) and lower highs (LHs), while respecting the established trendline. The price is expected to maintain this trajectory, with further tests of lower levels anticipated in the near future.
TF : 1D
Entry : $0.003233
Target : $0.002530
SL : $0.003727
#SLP/USDT analysis :
#SLP is currently moving within a bullish channel that is sloping upwards. The price has recently tested the support levels. It is likely to rebound from this point and target the previous swing high.
TF : 1D
Entry : $0.00246
Target : $0.00284
SL : $0.00226
#SLP/USDT analysis :
#SLP is currently finding support over the support zone and the 200-period exponential moving average (200 EMA). The price is expected to sustain its bullish momentum from this current zone and challenge the previous swing high.
TF : 30min
Entry : $0.00281
Target : $0.00287
SL : $0.00276