Skip to content

Instantly share code, notes, and snippets.

@cswiercz
Created December 19, 2019 21:26
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 cswiercz/4baec3f0aba05e5e2a93624649d7c9ca to your computer and use it in GitHub Desktop.
Save cswiercz/4baec3f0aba05e5e2a93624649d7c9ca to your computer and use it in GitHub Desktop.
Custom Bash Prompt
# A custom prompt that looks like this:
#
# <NEWLINE>
# (conda-environment) (current-datetime) [current-full-directory]
# username@host $
#
# First clear the PS1 variable. This allows conda setup to populate the PS1 with
# the current anaconda environment before we create a custom prompt. Necessary
# because I want a newline before each prompt. (Maybe better way?)
#
export PS1=
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/ec2-user/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/ec2-user/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/ec2-user/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/ec2-user/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# Add some color. The environment, date, and directory info should be dark so as
# to not be distracting. The main prompt is a nice color. The input should stand
# out the most.
#
PS1_CON="\[\e[37m\]"
PS1_TOP="\[\e[90m\]"
PS1_BOT="\[\e[94m\]"
PS1_CLR="\[\e[0m\]"
export PS1="\n${PS1_CON}${PS1}${PS1_TOP}(\d \t) [\w]\n${PS1_BOT}\u@\h \$${PS1_CLR} "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment