Preferred Installation
chmod +x idgen.sh && \
echo "alias idgen='$(pwd)/idgen.sh'" >> ~/.zshrc && \
source ~/.zshrcUsage
idgen| #!/usr/bin/env bash | |
| # ---------- 30 primary adjectives ---------- | |
| PRIMARY_ADJECTIVES=( | |
| "ancient" "brilliant" "calm" "daring" "elegant" "fierce" | |
| "gentle" "heroic" "infinite" "jovial" "keen" "luminous" | |
| "mystic" "noble" "optimal" "primed" "quiet" "radiant" | |
| "silent" "stellar" "timeless" "untamed" "vivid" "wild" | |
| "youthful" "zealous" "robust" "crisp" "bold" "serene" | |
| ) | |
| # ---------- 30 secondary adjectives ---------- | |
| SECONDARY_ADJECTIVES=( | |
| "agile" "brisk" "crimson" "dynamic" "etheric" "fearless" | |
| "glowing" "hollow" "icy" "jaded" "knotted" "lunar" | |
| "massive" "nimble" "ornate" "polished" "quick" "rigid" | |
| "shifting" "tender" "ultra" "velvet" "woven" "xenial" | |
| "yearning" "zonal" "stark" "brutal" "gentlemanly" "sparkling" | |
| ) | |
| # ---------- 30 animals ---------- | |
| ANIMALS=( | |
| "lion" "tiger" "cheetah" "panther" "jaguar" "leopard" | |
| "wolf" "fox" "bear" "eagle" "falcon" "owl" | |
| "shark" "dolphin" "whale" "orca" "rhino" "hippo" | |
| "elephant" "giraffe" "buffalo" "boar" "lynx" "cougar" | |
| "otter" "badger" "raven" "crow" "hawk" "python" | |
| ) | |
| # ---- Function to select a random element from any array ---- | |
| pick_random_element() { | |
| local array=("$@") | |
| local total=${#array[@]} | |
| local index=$(( RANDOM % total )) | |
| echo "${array[$index]}" | |
| } | |
| # ---- Generate unique identifier ---- | |
| first_adj=$(pick_random_element "${PRIMARY_ADJECTIVES[@]}") | |
| second_adj=$(pick_random_element "${SECONDARY_ADJECTIVES[@]}") | |
| animal=$(pick_random_element "${ANIMALS[@]}") | |
| echo "${first_adj}-${second_adj}-${animal}" |