SHTK_LIST_FILTER(3)
π shtk_list_filter(3) β the manual page, but make it cute
ok so real talk: this is the shtk_list_filter manual page, and if you're here it's because you want to keep some of a list and yeet the rest π«Ά and honestly? iconic behavior. Let's get into it bestie β¨
πΈ NAME πΈ
shtk_list_filter β filters the elements of a list based on a pattern π
like a bouncer for your list. only the ones that match the vibe check get in π
π LIBRARY π
You gotta shtk_import list first, bestie. no import, no function, no slay. periodt π
β¨ SYNOPSIS β¨
shtk_list_filter pattern [list_value1 .. list_valueN]
so it's pattern first (that's your rule), then all your list values lined up after it like π§ the pattern is the main character, lowkey.
π¦ DESCRIPTION π¦
okay so shtk_list_filter selects and returns the elements of the list you hand it β those are the args list_value1 through list_valueN β but only the ones that match the given shell pattern. the rest? not invited. sorry not sorry π
and the important bit, ngl, don't skip this: each list value must be provided as a separate positional parameter. separate. positional. parameter. every single one π₯ no stuffing them all into one string, no funny business, iykyk.
π quick vibe check: shell patterns are doing the matching here. your pattern is the whole rulebook.
π EXAMPLES π
here's the moment you've been waiting for, no cap π
original="foo foobar baz frobz"
filtered="$(shtk_list_filter 'foo*' ${original})"
echo "Results: ${filtered}"
look at that. foo and foobar made the cut, baz and frobz are crying in the group chat π note how ${original} is unquoted so each word becomes its own positional parameter β that's exactly the "separate positional parameter" thing we were yelling about. chef's kiss π
π SEE ALSO π
shtk(3)β the whole family πshtk_list(3)β the list functions, your new besties π«Ά
π°οΈ HISTORY π°οΈ
shtk_list_filter first appeared in shtk 1.0 β a legend from day one πβ¨
that's the whole page bestie, go filter something and absolutely ate π π₯ β xoxo, the Debian crew, November 7, 2014 π¦ (source/version + date, folded in all cute like, as promised π)
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2014 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms