GUARDS(1)
π guards β bestie's guide to picking files by vibe check π
okay so this is GUARDS(1), from the User Contributed Perl Documentation collection, and honestly? it's giving β¨file-selection-gatekeeperβ¨ and I'm obsessed. sit down, grab a strawberry π, we're doing this.
π NAME π
guards β the icon, the moment: it selects from a list of files that are guarded by conditions. periodt π
πΈ SYNOPSIS πΈ
guards [--prefix=dir] [--path=dir1:dir2:...] [--default=<0|1>]
[--check|--list] [--invert-match] [--with-guards] [--config=<file>]
symbol ...
likeβ¦ look at her. gorgeous. all those little options and then just a pile of symbols at the end. no cap π«Ά
β¨ DESCRIPTION β¨
so basically, bestie: the script reads a configuration file. that file can contain so-called guards, file names, and comments β a whole little mixed-content situation π β and then it writes out to standard output all the file names that satisfy every single guard. all of them. no exceptions. she's β¨selectiveβ¨.
the script takes a list of symbols as its arguments, and every line in the configuration file gets processed separately, one at a time. lowkey methodical.
lines may start with a number of guards. here are the guards that are defined, and I need you to actually read these, fr fr:
+xxxβ include the file(s) on this line if the symbolxxxis defined β¨-xxxβ exclude the file(s) on this line if the symbolxxxis defined π+!xxxβ include the file(s) on this line if the symbolxxxis not defined π-!xxxβ exclude the file(s) on this line if the symbolxxxis not defined-β exclude this file. it's literally just the bare minus. it's used to avoid spurious--checkmessages. she's here to keep the peace ποΈ
the guards are processed left to right, and the last guard that matches is the one that determines if the file is included. so like, the newest opinion wins, it's very main character energy π.
if no guard is specified at all, then the --default setting is what decides whether the file gets included. she's flexible like that π¦
and if no configuration file is specified, the script just reads from standard input. chill. easy. no big deal.
π§ the --check situation π§
the --check option compares the specification file against the file system β yes, they're being compared, it's a whole vibe check π. if:
- files are referenced in the specification that do not exist, or
- files are not enlisted in the specification file,
β¦then warnings get printed. that's it. that's the drama. π
π₯ paths and prefixes and files, oh my π₯
- the
--pathoption lets you specify which directory (or directories!! plural!!) to scan π - multiple directories are separated by a colon β that's the
":"character, exactly one of them, don't get creative bestie - the
--prefixoption specifies the location of the files π - alternatively, you can use the
--path=@<file>syntax to specify a file from which the file names will be read. yes, that's an at-sign, yes it's iconic, no I will not be taking questions β¨
π and the other three, because she contains multitudes π
- use
--listto list all files independent of any rules. no rules, no conditions, just vibes. she's free π - use
--invert-matchto list only the excluded patches. flipping the script, literally π¦ - use
--with-guardsto also include all inclusion and exclusion rules. she's showing her work, we love a transparent queen π
π AUTHOR π
Andreas Gruenbacher <agruen@suse.de>, SUSE Labs β absolute legend, thank you for your service π«‘π
okay that's the whole page, bestie, you ate that π
this was perl v5.40.1 and the page is dated 2026-01-23 β mwah, iconic, no notes πβ¨
π¦ where this page comes from
- ubuntu resolute: quilt 0.69-0.1 Β· GPL-2.0-or-later
- ubuntu stonking: quilt 0.69-0.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms