Skip to content

Instantly share code, notes, and snippets.

@dfelton
Last active November 2, 2020 00:17
Show Gist options
  • Save dfelton/7fff43172eb388a557a1343df374a243 to your computer and use it in GitHub Desktop.
Save dfelton/7fff43172eb388a557a1343df374a243 to your computer and use it in GitHub Desktop.
~/.bashrc preferences
# Git
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u@\[\033[32m\]\w\[\033[33m\]\$(git_branch)\[\033[00m\]\$ "
# Aliases
alias la='ls -la'
removeTrailingSpaces()
{
[ "$1" == "" ] && >&2 echo please provide path to directory && return;
[ ! -d "$1" ] && >&2 echo \"$1\" is not a directory && return;
while read filename
do
sed -i 's/[ ]*$//' "$filename"
done <<< "$(find $1 -type f -exec grep -lIm 1 -P ' $' {} \;)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment