Created
May 20, 2020 19:10
-
-
Save chrisuehlinger/789c541a429fe53dbdb2896d921ce887 to your computer and use it in GitHub Desktop.
My bash profile
This file contains 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
# Timer in the prompt inspired by https://jakemccrary.com/blog/2015/05/03/put-the-last-commands-run-time-in-your-bash-prompt/ | |
function timer_start { | |
timer=${timer:-$SECONDS} | |
} | |
function timer_stop { | |
timer_total_seconds=$(($SECONDS - $timer)) | |
timer_minutes=$(($timer_total_seconds / 60)) | |
timer_seconds=$(($timer_total_seconds % 60)) | |
timer_show="${timer_minutes}m ${timer_seconds}s" | |
unset timer | |
if (( "$timer_total_seconds" > "10")) | |
then | |
(afplay /System/Library/Sounds/Hero.aiff &) | |
fi | |
} | |
trap 'timer_start' DEBUG | |
if [ "$PROMPT_COMMAND" == "" ]; then | |
PROMPT_COMMAND="timer_stop" | |
else | |
PROMPT_COMMAND="$PROMPT_COMMAND; timer_stop" | |
fi | |
export PS1='[last: \[\033[1;96m\]${timer_show}\[\033[m\]] \w \nλ ' | |
#export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFh' | |
# Inspired by https://musigma.blog/2016/12/03/ssh-auto-retry.html | |
function sssh() | |
{ | |
false | |
while [ $? -ne 0 ]; do | |
ssh "$@" || (sleep 1;false) | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment