0
I have made my .bashrc give me two types of prompts;
longp: xanth@X-VboxTux:~➤➤➤
and
shortp: ➤
I have done this by writing a 0 or a 1 to a file and then to determine what prompt should be shown an if else tree is in the PS1 line.
so my question is... Is there a better way to store a state than writing a 0 or a 1 to a file?
code;
bashrcpl=$(<.bashrcpl)
if [ $bashrcpl = "0" ] || [ "$(whoami)" = root ]; then
if [ "$color_prompt" = yes ]; then
if [ "$(whoami)" = root ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[0;31m\]\u\[\033[0;32m\]@\[\033[0;36m\]\h\[\033[0;32m\]:\[\033[01;34m\]\w\[\033[0;31m\]➤\[\033[1;31m\]➤\[\033[0;32m\]➤\[\033[01;34m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]\u\[\033[0;32m\]@\[\033[0;36m\]\h\[\033[0;32m\]:\[\033[01;34m\]\w\[\033[0;31m\]➤\[\033[1;31m\]➤\[\033[0;32m\]➤\[\033[01;34m\] '
fi
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[0;32m\]➤\[\033[01;34m\] '
fi
# Alias to turn short terminal prompt on or off
alias shortp='echo "1" > .bashrcpl & source ~/.bashrc &> /dev/null'
alias longp='echo "0" > .bashrcpl & source ~/.bashrc &> /dev/null'