Even better random filenames
This is an evolution of the random filename generator I posted last week. Based on comments from BrianEnigma, this script allows you to specify “starts with” arguments to get an adjective and a noun using the WordNet dictionaries.
You can use the ready-made set I have here, or download the “Database files only” from WordNet and run this on the index.adj and index.noun files to create your libraries:
awk '{print $1}' index.adj > adjectives.txt
Edit the script below to point to the location of your dictionary files. Then just install and source it to start using. If you provide a single alphabet character as an argument, both the adjective and the noun will start with that letter. Provide two, separated by a space, and the adjective will start with the first one, the noun with the second. You can still provide no arguments to get random words from the full alphabet.
Examples:
$ gen_random_filename
measly_hypostatization
$ gen_random_filename a b
arrhythmic_bering_time
$ gen_random_filename z
zambian_zoysia_matrella
And the script:
I’m using this with a script that generates large blocks of random lorem ipsum (based on the Lorem Ingsoc scripts) in a series of files with a Marked index file for testing Marked 2. Here’s the basic idea, just for reference. It’s truncated, but shows how to use the function above in a script:
if [[ -z $title ]]; then
echo "Generating random title"
title=$(gen_random_filename $start_with_1 $start_with_2)
fi
mkdir include 2> /dev/null
includefile="include/$title"
echo -e "# Test Index\n\n" > $title-index.marked
jot -w "${includefile}-%d.md" - 1 $count|xargs -I % touch "%"
jot -w "${includefile}-%d.md" - 1 $count|xargs -I % echo -e "<<[%]\n" >> ${title}-index.marked