Skip to content

Instantly share code, notes, and snippets.

@predominant
Last active September 26, 2019 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save predominant/9b171447c4924de44755a661f15f3eba to your computer and use it in GitHub Desktop.
Save predominant/9b171447c4924de44755a661f15f3eba to your computer and use it in GitHub Desktop.
[Live Coding Shell] A Bash-entering script that sets up a nice, clean PS1 for live coding/presentations. #shell #livecode #bash
#!/bin/sh
PROMPT_COMMAND=__prompt_command
export PROMPT_COMMAND
__prompt_command() {
local EXIT="$?"
local RCol='\[\e[0m\]'
local Red='\[\e[0;31m\]'
local LightRed='\[\e[0;31m\]'
local Gre='\[\e[0;32m\]'
local BYel='\[\e[1;33m\]'
local BBlu='\[\e[1;34m\]'
local Pur='\[\e[0;35m\]'
PS1=""
if [ $EXIT != 0 ]; then
PS1+="${LightRed}"
else
PS1+="${Gre}"
fi
PS1+="██ ${EXIT}${RCol}\n"
PS1+="\n"
PS1+="────────────────────────────────────────────────────────────\n"
PS1+="\n"
PS1+="-> "
}
export -f __prompt_command
bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment