Try using the PROMPT_COMMAND
hook:
PROMPT_COMMAND() { randPromptNum=$[ $RANDOM % 3 ]; PS1=${POSSIBLE_PROMPTS[$randPromptNum]};}
For zsh, you must use precmd
instead of PROMPT_COMMAND
.
Before you use this, you must set up a variable with all possible prompts:
POSSIBLE_PROMPTS[0]="such prompt: "
POSSIBLE_PROMPTS[1]="much style: "
POSSIBLE_PROMPTS[2]="wow: "
If you want to adjust the number of prompts possible, remember to edit the % 3
.
EDIT - Result on cygwin
much style: echo hi
hi
such prompt: echo blah
blah
much style: pwd
/usr/bin
such prompt: yes y | head
y
y
y
y
y
y
y
y
y
y
wow: echo foo
foo
such prompt: