aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-01 10:52:59 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-01 10:52:59 +1200
commit4be76c038b78c04c2aeaf7d92fb75acef4775981 (patch)
tree55ed011a4b968a12e529215008c82335b2c01973
parentAdd rnda(1) (diff)
downloaddotfiles-4be76c038b78c04c2aeaf7d92fb75acef4775981.tar.gz
dotfiles-4be76c038b78c04c2aeaf7d92fb75acef4775981.zip
Change rndf(1) to use rnda(1)
-rwxr-xr-xbin/rndf6
-rw-r--r--man/man1/rndf.12
2 files changed, 3 insertions, 5 deletions
diff --git a/bin/rndf b/bin/rndf
index fa11e68e..6418529c 100755
--- a/bin/rndf
+++ b/bin/rndf
@@ -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>