Added some small boring scripts and programs writen in few last years
[mirrors/Programs.git] / misc / gbook / rand.sh
1 #!/bin/bash
2
3 getline() {
4 head -n "$1" | tail -n 1;
5 }
6
7 randline() {
8 while read line; do echo $((len+=1)) >/dev/null; echo "$line"; done;
9 echo "$(( ($RANDOM % $len) + 1 ))" >&2;
10 }
11
12
13 ls | randline
This page took 0.260721 seconds and 4 git commands to generate.