|Linux & Unix Commands - Search Man Pages
SHUFFLE(1) BSD General Commands Manual SHUFFLE(1)
shuffle -- print a random permutation of the command line arguments
shuffle [-0] [-f filename ...] [-n number] [-p number] [arg] [...]
The shuffle program prints a random permutation (or ``shuffle'') of its command line argu-
ments. This can be useful in shell scripts for selecting a random order in which to do a
set of tasks, view a set of files, etc.
If the -f option is given, the data is taken from that files' contents or if the filename is
If the -n option is given, its argument is treated as a number, and the program prints a
random permutation of the numbers greater than or equal to 0 and less than the argument.
If the -p option is given, its argument is treated as a number, and the program prints that
number of randomly selected lines or arguments in a random order.
The -0 option changes the field separator character from \n to \0, so that the output is
suitable to be sent to xargs(1) (to handle filenames with whitespace in them).
$ shuffle a b c d
$ shuffle -p 1 a b c d
$ shuffle -n 4 -p 2
The shuffle program first appeared in NetBSD 1.4.
Written by Perry E. Metzger <email@example.com>.
BSD February 18, 2009 BSD
All times are GMT -4. The time now is 02:06 AM.