Reorganize bash_aliases entirely, add some readme.

This commit is contained in:
Anna Wiggins 2017-03-17 15:36:31 -07:00
parent bd95a93220
commit 63c5cb05bc
No known key found for this signature in database
GPG key ID: 682893DD0448ED78
5 changed files with 27 additions and 13 deletions

18
bash/2line_prompt.sh Normal file
View file

@ -0,0 +1,18 @@
# Produces a nice, colorful 2-line prompt, basically of the form:
# [username@hostname]-[current_directory]
# $
#
# Also includes a [x] on the first line if the last command returned false.
#
# TODO: add current git branch
function fancy_ps1 () {
local COLOR1="\033[1;32m"
local COLOR2="\033[0;32m"
local NO_COLOR="\033[0m"
local cur_pwd=${PWD//$HOME/\~}
echo -e "[${COLOR2}${cur_pwd}${NO_COLOR}]"
}
PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200\$(fancy_ps1)\[\033[0;37m\]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]"