aboutsummaryrefslogtreecommitdiff
path: root/bin/rndf
blob: 6418529cd87b347bdea9998908c47f66d9dcdc03 (plain) (blame)
1
2
3
4
5
6
7
8
9
#!/bin/sh
# 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
exec rnda