News for hackers. Stuff that matters.
Re:Pure Bash Bible by emmelaich on Thursday September 19, 2019 @04:37AM (#21014433)
I don't like this function very much but here's a few notes...

: is a "do nothing" command -- but the line is still evaluated

%% means to replace leading chars that match pattern

## means replace trailing chars

I don't know why they're using $_; thats the variable containing the interpreter name, i.e. "/bin/bash" [edit - also the name of the previous command!]

I can't be bothered analyzing it any further :-)

Re:Pure Bash Bible by vghnb on Thursday September 19, 2019 @04:42AM (#21014457)
After the first command, $_ expands to whatever the last argument to the previous command expanded to. In this case the previous command was : and the only argument is by definition the last. This is how you chain things together without clunky temporary variables.