diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 10:52:59 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-01 10:52:59 +1200 |
commit | 4be76c038b78c04c2aeaf7d92fb75acef4775981 (patch) | |
tree | 55ed011a4b968a12e529215008c82335b2c01973 | |
parent | Add rnda(1) (diff) | |
download | dotfiles-4be76c038b78c04c2aeaf7d92fb75acef4775981.tar.gz dotfiles-4be76c038b78c04c2aeaf7d92fb75acef4775981.zip |
Change rndf(1) to use rnda(1)
-rwxr-xr-x | bin/rndf | 6 | ||||
-rw-r--r-- | man/man1/rndf.1 | 2 |
2 files changed, 3 insertions, 5 deletions
@@ -1,11 +1,9 @@ #!/bin/sh -# Choose a random file from a given directory. Ignores dot files. +# Choose a random file from a given directory using rnda(1). Ignores dot files. dir=${1:-.} set -- "$dir"/* if ! [ -e "$1" ] ; then printf >&2 'rndf: No files found in %s\n' "$dir" exit 1 fi -argi=$(rndi 1 "$#") || exit -shift "$((argi-1))" -printf '%s\n' "$1" +exec rnda diff --git a/man/man1/rndf.1 b/man/man1/rndf.1 index 522d44e1..b2d74954 100644 --- a/man/man1/rndf.1 +++ b/man/man1/rndf.1 @@ -14,6 +14,6 @@ prints the name a random file (excluding dot files) from the given directory, defaulting to the current directory. It uses rndi(1), which is not a high-quality random number source. .SH SEE ALSO -rndi(1) +rndi(1), rnda(1) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> |