RR(1)

NAME
rr - run commands with shuffled parameters

SYNOPSIS
rr [-1DdEeiNOpRrv] [-l list] [-m margin] [-n maxargs] [-o regex] [-s regex] [-x regex] cmd [flags --] param1 ...

DESCRIPTION
rr runs cmd, keeping options in the same order up to the -- marker, then shuffling all subsequent parameters in a random order.

The options are as follows:

-1  Keep just one random parameter for running.

-D  Scan parameters and recursively add each leaf directory, e.g., each directory that does contain only files and not subdirectories.

-d  Without this flag, -- on the command line will be propagated to each execution of the command.

-E  Use extended regular expression syntax for filtering (-o, -s and -x). By default, rr will use basic regular expression syntax ( see regex(3)). Note that this is a position-dependent option: you can specify basic regular expressions before -E, and extended regular expressions after.

-e  Exit on error after running command.

-i  Use case-insensitive regular expressions for filtering (-o, -s and -x). Note that this is a position-dependent option: You can specify case-sensitive regular expressions before -i, and case-insensitive after.

-l list
    Add the contents of file list to the parameters, each line being a single parameter. As usual, ‘-’ stands for standard input.

-m margin
    If arguments run too long, rr will split the command into batches instead of running into the kernel limit, allowing for margin bytes.

-N  Do not shuffle parameters.

-n maxargs
    Like xargs(1), split the command into batches of at most maxargs arguments. Note that maxargs counts the full command line, so

    rr -n3 feh -Z -- *

    will run each batch with exactly one random filename.

-O  Run the command exactly once.

-o regex
    Only keep parameters that match regex.

-p  Do not run anything. Consider the full argument list as parameters and randomize them, then print the list, or parts of it according to flags -1On.

-R  Rotate the arguments instead of shuffling them.

-r  Scan parameters and recursively expand each directory.

-s regex
    Before shuffling parameters, skip until a parameter matching regex. Last match wins.

-v  Echo the command being run before running it.

-x regex
    Filter out parameters that match regex.

EXAMPLES
Run command with options on a random list of files:

rr xv -maxpect -- *.jpg

Select a specific number of files from a list and display them, echo what's actually running:

    rr -Ov -n5 feh -Z --bg-center -- *

Play all mp4 videos under a specific folder in fullscreen, limit to what mpv(1) can manage, exit in case of error, do not randomize files:

rr -n1500 -erN -o '.*.mp4' mpv -fs -- videos

Display a random line from file:

rr -n2 -O -l file echo

Same thing, different options:

rr -1pl file

AUTHORS
The rr utility was written by Marc Espie <espie@openbsd.org>.