Made separate bashrc and profile which parse eachother.

So everythin is always defined in a bash shell
This commit is contained in:
Eric Teunis de Boone 2016-09-26 18:11:51 +02:00
parent 37123ca4cd
commit d47333930f
6 changed files with 22 additions and 32 deletions

View File

@ -5,7 +5,12 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
[ ! -z "$DOTFILES" ] && DOTBASH="$DOTFILES/bash"
[ -z "$DOTFILES" ] && source ~/.profile
##
[ -z "$DOTFILES" ] && echo ".profile missing" && exit 1
DOTBASH="$DOTFILES/bash"
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

1
bash/profile Normal file
View File

@ -0,0 +1 @@
[ -z "$DOTFILES" ] && source "$HOME/.profile"

View File

@ -7,10 +7,10 @@
- link:
~/.bashrc: bash/bashrc
~/.profile: profiles/main
~/.profile: profile.sh
~/.gitconfig: git/gitconfig
~/.tmux.conf: tmux/tmux.conf
~/.vimrc: vim/vimrc
- shell:
- git submodules update # after linking ~/.gitconfig
#- shell:
# - git submodules update # after linking ~/.gitconfig

25
profile
View File

@ -1,25 +0,0 @@
# Define DOTFILES for easy access
DOTFILES="$HOME/.dotfiles"
# Add DOTFILES/bin/ to PATH
DOTBIN="$HOME/.bin"
if [ -d "$DOTBIN" ]; then
export PATH="$PATH:$DOTBIN"
fi
# Always try to use vi(m) if possible
export EDITOR="vi"
# Source Envs
DOTENVS="$HOME/.envs"
if [ -d "DOTENVS" ]; then
source "$DOTENVS/*.active"
fi
# Source Bashrc if BASH
if [ "$BASH" ] && [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

9
profile.sh Normal file
View File

@ -0,0 +1,9 @@
# Define DOTFILES for easy access
DOTFILES="$HOME/.dotfiles"
# Source main profile
[ -r "$DOTFILES/profiles/main.sh" ] && source "$DOTFILES/profiles/main.sh"
# Source machine specific profile
[ -r "$DOTFILES/profiles/$HOSTNAME.profile"] && source "$DOTFILES/profiles/$HOSTNAME.profile"

View File

@ -1,6 +1,6 @@
DOTFILES="$HOME/.dotfiles"
#Add DOTFILES/bin/ to PATH
DOTBIN="$HOME/.bin"
DOTBIN="$DOTFILES/bin"
if [ -d "$DOTBIN" ]; then
export PATH="$PATH:$DOTBIN"
fi
@ -19,6 +19,6 @@ fi
# Source Bashrc if BASH
if [ "$BASH" ] && [ -f ~/.bashrc ]; then
source ~/.bashrc
if [ "$BASH" ] && [ -f $DOTFILES/bash/bashrc ]; then
source $DOTFILES/bash/bashrc
fi