Last active
March 28, 2024 17:13
-
-
Save birkin/5f20a1b53a6a2337d8e9083d704349c8 to your computer and use it in GitHub Desktop.
server-terminal configuration customizations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ------------------------------------------------------------------ | |
## birkin config | |
## ------------------------------------------------------------------ | |
## aliases ---------------------------------------------------------- | |
alias cp="cp -i" | |
alias ls="ls -ahlF" | |
alias mv="mv -i" | |
alias rm="rm -i" | |
## prompt config ---------------------------------------------------- | |
## - dynamic background based on server name and white text | |
## - The username of the current user (\u) | |
## - The hostname of the machine (\h) | |
## - The current working directory (\W) | |
## Define colors | |
red_bg="\[\033[101m\]" # for dev-servers | |
green_bg="\[\033[102m\]" # for prod-servers | |
deep_blue_bg="\[\033[48;5;19m\]" # other | |
white_text="\[\033[97m\]" | |
reset_color="\[\033[0m\]" | |
## Determine the hostname | |
hostname=$(hostname) | |
## Conditional logic to set prompt based on hostname prefix | |
if [[ $hostname == d* || $hostname == q* ]]; then | |
export PS1="$red_bg$white_text\u@\h \W DEV-$ $reset_color " | |
elif [[ $hostname == p* ]]; then | |
export PS1="$green_bg$white_text\u@\h \W PROD-$ $reset_color " | |
else | |
export PS1="$deep_blue_bg$white_text\u@\h \W DEV-$ $reset_color " | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment