Should've made this a long time ago:

function ciglob {
    #case-insensitive glob generator
    echo "$*" |while read -N1 c; do
        case "$c" in
            [a-zA-Z])   echo -n "[${c^^}${c,,}]";;
            *)          echo -n "$c"
        esac
    done
}
~ $ ciglob "Hello, world!"
[Hh][Ee][Ll][Ll][Oo], [Ww][Oo][Rr][Ll][Dd]!
~ $ ls -ld $(ciglob documents)
drwxr-xr-x 52 ~~~ ~~~ 20,480 Apr 10 11:45 Documents

(Not the most useful example, but I did have a use case in mind when I wrote it ;)

P.S. (This is a valid way to close a parenthesis. Fight me ;)

#bash #ksh #sh #shell #UnixShell #POSIX #PosixShell #ShellScripting

0

If you have a fediverse account, you can quote this note from your own instance. Search https://polymaths.social/users/rl_dane/statuses/01JRGA3XM5ZX7JRTJHHZXGE85F on your instance and quote it. (Note that quoting is not supported in Mastodon.)