summaryrefslogtreecommitdiffstats
path: root/util/bin
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-07-31 02:16:15 +0200
committermakefu <github@syntax-fehler.de>2011-07-31 02:18:03 +0200
commit3a7d1fde735a67f7b35feee62d60ebc634403c16 (patch)
treec1ca3e5941fe9e6d3f9da4dbdc4895a6037e2a24 /util/bin
parentea58e1678fd362079ab550d8fe75eeb58e9042b2 (diff)
randline: reimplemented
Diffstat (limited to 'util/bin')
-rwxr-xr-xutil/bin/randline11
1 files changed, 1 insertions, 10 deletions
diff --git a/util/bin/randline b/util/bin/randline
index cd9476e7..051734c5 100755
--- a/util/bin/randline
+++ b/util/bin/randline
@@ -1,12 +1,3 @@
#! /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"
+cat | shuf | head -n 1