bash: how to delete elements from an array based on a pattern

Filtering an array is tricky if you consider possibility of elements containing spaces (not to mention even “weirder” characters). In particular answers given so far (referring to various forms of ${x[@]//pref*/}) will fail with such arrays. I have investigated this issue somewhat and found a solution however it is not a nice one-liner. But at … Read more

How to search for non-ASCII characters with bash tools?

Try: nonascii() { LANG=C grep –color=always ‘[^ -~]\+’; } Which can be used like: printf ‘ŨTF8\n’ | nonascii Within [] ^ means “not”. So [^ -~] means characters not between space and ~. So excluding control chars, this matches non ASCII characters, and is a more portable though slightly less accurate version of [^\x00-\x7f] below. … Read more

Configure GPG for Git on Windows

Update Oct. 2018, as commented below by PHPirate: λ git –version git version 2.19.1.windows.1 λ gpg –version gpg (GnuPG) 2.2.9-unknown libgcrypt 1.8.3 Copyright (C) 2018 Free Software Foundation, Inc. No trace of that update in git-for-windows/git/releases Original answer (2017): By default, Git for Windows includes a gpg1, not gpg2 vonc@bvonc MINGW64 ~/.ssh $ gpg –version … Read more