2022-02-05 22:58:21 -06:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-10-28 21:23:40 -05:00
|
|
|
# if not interactive, don't do anything
|
|
|
|
[ -z "$PS1" ] && return
|
|
|
|
|
2022-02-05 22:58:21 -06:00
|
|
|
# some housekeeping
|
2024-11-29 03:50:32 -06:00
|
|
|
alias ls="ls --color=auto --group-directories-first"
|
|
|
|
|
2024-04-10 19:20:09 -05:00
|
|
|
function cd() {
|
2024-11-29 03:50:32 -06:00
|
|
|
builtin cd "$@" && ls --color=auto --group-directories-first
|
2024-04-10 19:20:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
# history
|
|
|
|
HISTCONTROL=ignorespace:ignoredups:erasedups
|
|
|
|
HISTFILESIZE=9999999999
|
|
|
|
HISTSIZE=9999999999
|
|
|
|
|
2024-10-28 21:23:40 -05:00
|
|
|
# bash specific settings
|
|
|
|
set -o vi # vim mode
|
|
|
|
shopt -s autocd
|
2024-04-10 19:20:09 -05:00
|
|
|
shopt -s cmdhist
|
|
|
|
shopt -s histreedit
|
|
|
|
shopt -s histappend
|
|
|
|
shopt -s histverify
|
2022-10-18 18:19:26 -05:00
|
|
|
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="\w\$ "
|
|
|
|
|
|
|
|
if [ -n "$IN_NIX_SHELL" ]; then
|
|
|
|
NIX_SHELL_PS1="nix:"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$USER" = "root" ]; then
|
|
|
|
USER_PREFIX="\[\033[41m\]root:\[\033[0;0m\]"
|
2024-10-28 23:39:35 -05:00
|
|
|
elif [ "$USER" == "ryan" ] && [ "$HOSTNAME" = "netbox" ]; then
|
|
|
|
USER_PREFIX=""
|
2024-10-28 21:23:40 -05:00
|
|
|
elif [ "$USER" != "usr" ]; then
|
|
|
|
USER_PREFIX="$USER:"
|
|
|
|
fi
|
2022-06-26 19:01:06 -05:00
|
|
|
|
2024-07-24 13:37:30 -05:00
|
|
|
# hostname shenanigans
|
|
|
|
case "$HOSTNAME" in
|
2024-08-31 20:13:14 -05:00
|
|
|
"aristotle")
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="$USER_PREFIX\[\033[36;1m\]${NIX_SHELL_PS1}arist:$PS1\[\033[0;0m\]"
|
2024-08-31 20:13:14 -05:00
|
|
|
;;
|
2024-07-24 13:37:30 -05:00
|
|
|
"copernicus")
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="$USER_PREFIX\[\033[97;1m\]${NIX_SHELL_PS1}coper:$PS1\[\033[0;0m\]"
|
2024-07-24 13:37:30 -05:00
|
|
|
;;
|
|
|
|
"mlg")
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="$USER_PREFIX\[\033[94;1m\]${NIX_SHELL_PS1}mlg:$PS1\[\033[0;0m\]"
|
2024-07-24 13:37:30 -05:00
|
|
|
;;
|
|
|
|
"netbox")
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="$USER_PREFIX\[\033[95;1m\]${NIX_SHELL_PS1}net:$PS1\[\033[0;0m\]"
|
2024-07-24 13:37:30 -05:00
|
|
|
;;
|
|
|
|
*)
|
2024-10-28 21:23:40 -05:00
|
|
|
PS1="$USER_PREFIX\[\033[96;1m\]${NIX_SHELL_PS1}unk:$PS1\[\033[0;0m\]"
|
2024-07-24 13:37:30 -05:00
|
|
|
;;
|
|
|
|
esac
|