blob: cd9476e7dd54570b8d7c8c5105f22587961fed2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#! /bin/sh
#
# choose a line randomly.
#
set -euf
lines="`cat`"
count=`echo "$lines" | wc -l`
random=`od -An -t u8 -N 8 /dev/urandom`
choice=`echo "$random % $count + 1" | bc`
echo "$lines" | sed -n "${choice}p"
|