metanohi/site/writings/bash-prompt.org

1.0 KiB

My BASH prompt (outdated)

#&summary What my prompt used to do and what it looked like. #&

My old BASH prompt

I had a strange bash prompt. To use it, first, copy this into your .bashrc:

function ps1lr {
    if [ $1 == 0 ]; then
        echo -ne "\033[42m\033[01;30m"
    else
        echo -ne "\033[41m\033[01;34m"
    fi
    length-extra-prepend $1 3
}

function ps1sp {
    pwdw=$(($COLUMNS-20))
    if (( $pwdw < 40 )); then
        pwdw=40
    fi
    length-too-much-shorten "$(pwd | sed s%$HOME%~%)" $pwdw
}

#PROMPT_COMMAND=""
PS1='\[\033[00m\]$(ps1lr $?)\[\033[45m\] \[\033[44m\]\[\033[01;37m\]\
$(date +%H:%M)\[\033[45m\] \[\033[46m\]\[\033[01;33m\]\
$(ps1sp)\[\033[00m\]\n\[\033[45m\]\[\033[01;33m\]\u\[\033[01;32m\]@\
\[\033[01;36m\]\h\[\033[43m\]\[\033[01;30m\]:\[\033[40m\]\
\[\033[01;33m\]\$\[\033[00m\] '

Second, download /ngws/metanohi/src/commit/6c244ddd706e5e58c53eb74faa39f4adcd833b0f/site/writings/bash-prompt-extras.tar.gz and put the included programs somewhere in =$PATH=&sh.

Not anymore

I didn't actually need all the features.