Conversation
Notices
-
Embed this notice
Machismo (zerglingman@freespeechextremist.com)'s status on Friday, 10-Nov-2023 01:48:04 JST Machismo @kirby function ifsrev { __temp=$(tr "$2" '\n' <<< "$1" | tac | tr '\n' "$2"); echo -n ${__temp:0:-1}; } - Pleroma-tan likes this.
- Pleroma-tan repeated this.
-
Embed this notice
Pleroma-tan (kirby@lab.nyanide.com)'s status on Friday, 10-Nov-2023 01:48:25 JST Pleroma-tan @Zerglingman good. i like this one. -
Embed this notice
Machismo (zerglingman@freespeechextremist.com)'s status on Friday, 10-Nov-2023 01:51:59 JST Machismo @kirby I actually had need of it in mkcerts.sh. Pleroma-tan likes this. -
Embed this notice
Pleroma-tan (kirby@lab.nyanide.com)'s status on Friday, 10-Nov-2023 01:57:16 JST Pleroma-tan @Lyx @Zerglingman @Owl @Owl looks like shell or awk -
Embed this notice
Lyx (lyx@cum.salon)'s status on Friday, 10-Nov-2023 01:57:18 JST Lyx @Zerglingman @kirby what does tht say if i might inquire¿ and is that python¿ Pleroma-tan likes this. -
Embed this notice
Pleroma-tan (kirby@lab.nyanide.com)'s status on Friday, 10-Nov-2023 01:57:28 JST Pleroma-tan @Lyx @Owl @Owl @Zerglingman shell -
Embed this notice
Lyx (lyx@cum.salon)'s status on Friday, 10-Nov-2023 02:33:18 JST Lyx @Zerglingman @kirby @Owl @Owl thats extremely cool what made you think to make it reverso like that¿ Pleroma-tan likes this. -
Embed this notice
Machismo (zerglingman@freespeechextremist.com)'s status on Friday, 10-Nov-2023 02:33:19 JST Machismo @Lyx @Owl @Owl @kirby It's bash/sh.
I called it ifsrev because it's basically like using rev(1) but with internal field separator (a la read(1P)).
tr is a replacement function, so replace the second argument with a newline throughout the first argument (I probably should have done those the other way around so the body would be just second argument onward), then tac is inverse cat - read lines out from last to first - then tr it again to replace the newlines.
So it will produce incorrect output if the input contains a newline.
Also the last bit is to strip out random newlines/blanks of some kind, I forget what. Probably not actually necessary except when dealing with something extremely anal like ACME.Pleroma-tan repeated this.