-

Print the absolute value of an integer.
-

Return 0 if a nameref array contains the given value, otherwise 1.
-

Prompt until the user answers y/yes or n/no. Echoes 1 for yes and 0 for no.
-

Turn on errexit, nounset, pipefail, and a safer IFS, plus xtrace when DEBUG is set.
-

Print a line padded so the text sits in the middle of the terminal width.
-

Exit with an error if any name in COMMANDS is missing from PATH.
-
Coloured error, warning, and success lines

Print messages in red, yellow, or green when the terminal supports colour.
-
Common set options for robust scripts

Enable errexit, errtrace, nounset, pipefail, and xtrace.
-
Compare dotted version strings

Return a negative number, zero, or a positive number for less, equal, or greater.
-

Compare two numeric version strings. Returns 0 if equal, 1 if the first is greater, 2 if less.
-

Print a message and return 0 on y/yes, 1 otherwise (default N).
-

Sleep for N seconds while rewriting a message that can include $seconds.
-

Remove all local tags, then delete the same names on origin.
-

Tell whether stdout is a terminal, a pipe, or a redirection.
-
Extract a numeric version from text

Pull the first run of digits and dots out of a string.
-

Print the top-level directory of a git repo, or an error if the path is not a repo.
-

Track worker PIDs and thread IDs, and kill children that exceed PATIENCE.
-

Run Parallel::ForkManager jobs and kill any child that exceeds PATIENCE seconds.
-

Join array values with a separator, optionally using a different separator before the last item.
-

Return the greater of two comparable values.
-

Return the lesser of two comparable values.
-

Return the expanded path of an executable, or not installed.
-

Return the value for a key, with an optional case-insensitive variant.
-

Return 1st, 2nd, 3rd, 11th, and so on for an integer.
-
Partition an array into N groups

Split a list into p slices, spreading the remainder across the first groups.
-

Wait for Enter before continuing; exit 0 on EOF.
-

Send a webhook payload with an optional channel and username.
-

Walk caller frames from the current function back toward main.
-

Print the version from terraform --version, or exit if Terraform is missing.
-
Record how a script was invoked

Set path, name, sourced-or-not, and argument variables for the current script.
-
Replace placeholders from an associative array

Substitute each key in a nameref map with its value inside a file.
-

Re-run a block with exponential backoff until it succeeds or hits a limit.
-

Re-call a function with exponential backoff until it succeeds or hits a limit.
-

Re-run a command with exponential backoff until it succeeds or hits a limit.
-
Rollback stack on interrupt or error

Push cleanup functions onto a LIFO stack and run them if INT, TERM, or EXIT fires.
-

Transpose a matrix and reverse each row to rotate it clockwise.
-
Run a command and capture output

Execute a argv list and return status, stdout, and stderr.
-

Print, execute, and report a non-zero status; pause when interactive.
-

Use sudo -i to run librarian-puppet in the production Puppet environment without editing sudoers.
-

Turn a second count into days, hours, minutes, and seconds.
-

Format an integer number of seconds as a zero-padded hours, minutes, and seconds string.
-

Populate tput colour variables when stdout is a colour-capable terminal.
-
Silent mode with a forced-output helper

When VERBOSE is false, send stdout and stderr to /dev/null, and still print forced messages.
-
Simple Parallel::ForkManager pool

Fork a fixed number of workers and wait for them to finish.
-

Return 0 if the first string contains the second, otherwise 1.
-
Test whether a directory is a git work tree

Return 0 if the current or given directory is inside a git work tree.
No matching snippets
Try changing the search text or selecting different filters.