From 04f4a7df197ce327f36b666869a1ca2f09934e58 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 22 Aug 2019 16:33:38 +0200 Subject: Tidying up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- bashrc | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index 0a03e7d..cd3ee78 100644 --- a/bashrc +++ b/bashrc @@ -31,8 +31,8 @@ alias cd..='cd ..' # Sources the given file if it really exists. source_maybe() { - if [ -f $1 ]; then - source $1 + if [ -f "$1" ]; then + source "$1" fi } @@ -59,27 +59,18 @@ export LESS="FSRX" export PAGER=less # git thingies. -source_maybe $HOME/.gitcompletion.sh +source_maybe "$HOME/.gitcompletion.sh" alias gti=git -# hg thingies. -source_maybe $HOME/.hgcompletion.sh -__hg_branch() { - if [ -d .hg ]; then - local b=`cat .hg/branch` - echo -e "\033[0;32m@\033[1;32m$b\033[0m" - fi -} - # Setting up PS1. -PS1='\u:\w$(__hg_branch)$(__git_ps1 "\[\033[0;32m\]@%s\[\033[0m\]\]") $ ' +PS1='\u:\w$(__git_ps1 "\[\033[0;32m\]@%s\[\033[0m\]\]") $ ' ## # Programming languages and environments. # Rake completion -if [ -f $HOME/.rake_completion ]; then - complete -C $HOME/.rake_completion -o default rake +if [ -f "$HOME/.rake_completion" ]; then + complete -C "$HOME/.rake_completion" -o default rake fi # Alias bundle exec @@ -99,15 +90,15 @@ export PATH=$GOROOT/bin:$PATH:$GOPATH/bin # Misc. # The g utility. See: https://github.com/mssola/g -source_maybe $HOME/.g.sh -source_maybe $HOME/.gcompletion.sh +source_maybe "$HOME/.g.sh" +source_maybe "$HOME/.gcompletion.sh" # Complete the `docker` command if possible. -source_maybe $HOME/.dockercompletion.sh +source_maybe "$HOME/.dockercompletion.sh" # Add the `bin` dir to the path if possible. See: # https://github.com/mssola/dotfiles. -if [ -d $HOME/bin ]; then +if [ -d "$HOME/bin" ]; then export PATH=$HOME/bin:$PATH fi @@ -120,7 +111,7 @@ alias ag='ag --nocolor --path-to-ignore ~/.agignore' alias random_string="cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1" # Cargo environment. -source_maybe $HOME/.cargo/env +source_maybe "$HOME/.cargo/env" # SUSE export SALT_DIR="$HOME/Projects/kubic-project/salt" -- cgit v1.2.3