ca5
4/6/2016 - 7:39 AM

escgen

escgen

#!/bin/bash

function get_random_word(){
    initial=$1
    initial_u=`echo $1|tr '[a-z]' '[A-Z]'`
    ret=`curl -s -L https://en.wikipedia.org/wiki/Special:Randompage | awk 'match($0, /<title>.*<\/title>/){print substr($0,RSTART + 7,RLENGTH - 50)}' | grep -E "^[${initial}${initial_u}]"`
    if [ "$ret" = "" ];then
        get_random_word $initial
    else
        echo $ret
    fi
}
echo -n "E: "
get_random_word e
echo -n "S: "
get_random_word s
echo -n "C: "
get_random_word c