Choosing a Random Command Line Argument


The shuf command normally generates a random permutation of its input lines. However with the -e (echo) and -n 1 (show only 1 output) arguments you can make it choose a random command line argument.

For example, ping a random well-known DNS server:

$ ping $(shuf -n 1 -e 1.1.1.1 1.1.1.2 8.8.8.8 8.8.4.4 4.2.2.1 4.2.2.2)