docs
[mirrors/Programs.git] / misc / gbook / rand.sh
CommitLineData
21c4e167
H
1#!/bin/bash
2
3getline() {
4 head -n "$1" | tail -n 1;
5}
6
7randline() {
8 while read line; do echo $((len+=1)) >/dev/null; echo "$line"; done;
9 echo "$(( ($RANDOM % $len) + 1 ))" >&2;
10}
11
12
13ls | randline
This page took 0.14209 seconds and 4 git commands to generate.