Skip to main content
100%

Script to select random oh-my-posh theme on shell init

✓ Published0🌍 Public
Aarchae0pteryx
Last edited May 23, 2022
Created on May 23, 2022

A shell script selects a random oh-my-posh theme on every shell init, producing a varied prompt appearance. It builds a list of theme file paths by scanning the `POSH_THEME_DIR` directory (derived from `brew --prefix oh-my-posh`), then uses Bash's `$RANDOM` to pick one index. The chosen theme path is echoed and passed to `oh-my-posh --init --shell zsh --config`, which loads it into the Zsh session. The script relies on standard Bash array handling, command substitution, and a `while read` loop over `find` output, with no external visualization libraries.

AI-generated description

Similar vizzes