# hilton meyer

Custom Bash Command Prompt

This is the setup I use for my bash prompts in various environments. I simply add the following to my `.bashrc` file. This is more a reference for me but if you find it useful give it a go and play around with the various colors.

``````Custom Prompt###############
set_prompt () {
Reset='\[\e[0m\]'

Black='\[\e[0;30m\]'
Blue='\[\e[0;34m\]'
Green='\[\e[0;32m\]'
Cyan='\[\e[0;36m\]'
Red='\[\e[0;31m\]'
Purple='\[\e[0;35m\]'
Brown='\[\e[0;33m\]'

if [ \$(whoami) == 'root' ] || [[ \$(whoami) == *"prod"* ]] || [[ \$(whoami) == *"PROD"* ]]; then
PrimaryColor="\${Red}"
SecondaryColor="\${Brown}"
promptSymbol="\${Red}!! "
else
PrimaryColor="\${Green}"
SecondaryColor="\${Blue}"
promptSymbol="\${Green}\$ "
fi

userhost="\${PrimaryColor}\$(whoami)@\$(hostname -s) "
currentdir="\${SecondaryColor}[\$(pwd | sed "s!^\$HOME!~!")] "
currentTime="\${PrimaryColor}\$(date +%H:%M:%S) "

PS1="\$Reset\$White"
PS1+="\$userhost"
PS1+="\$currentdir"
PS1+="\$currentTime"
PS1+="\$promptSymbol"
PS1+="\$Reset"
}

PROMPT_COMMAND='set_prompt'
################Custom Prompt End###############
``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.512301,"math_prob":0.8579052,"size":1061,"snap":"2020-34-2020-40","text_gpt3_token_len":334,"char_repetition_ratio":0.17975402,"word_repetition_ratio":0.0,"special_character_ratio":0.4128181,"punctuation_ratio":0.10795455,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9888954,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-09T08:55:11Z\",\"WARC-Record-ID\":\"<urn:uuid:db8383b8-9196-4c89-91de-b151ab11a84b>\",\"Content-Length\":\"3302\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5eb66f96-14c3-4337-abfe-a45ffa5f095e>\",\"WARC-Concurrent-To\":\"<urn:uuid:ee5fd8ed-14f5-45fd-a413-c17552fdf75d>\",\"WARC-IP-Address\":\"192.81.212.192\",\"WARC-Target-URI\":\"https://hiltonmeyer.com/articles/custom-bash-prompt.html\",\"WARC-Payload-Digest\":\"sha1:JRNVFS4OS4XYCGZ7W4JWEROGXGBCYYVB\",\"WARC-Block-Digest\":\"sha1:IKX6FG6SLH5OZIFYAJVMZFGU2VNQ6XHL\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439738523.63_warc_CC-MAIN-20200809073133-20200809103133-00404.warc.gz\"}"}