From 0e1fe12b322dd5610d02f5ce5f7de3e2f6e5cd26 Mon Sep 17 00:00:00 2001 From: Jannik Zander Date: Sun, 22 May 2016 20:25:37 +0200 Subject: [PATCH] Divide bash files into profile ond rc --- .bash_profile | 1 + .bashrc | 4 +++- .config/bash/rc/completion | 2 +- .config/bash/rc/options | 5 +---- .config/profile/rc/{exports => environ.sh} | 15 ++++++++++----- .config/{bash => profile}/rc/git-prompt.sh | 0 .config/profile/rc/{paths => paths.sh} | 2 +- .config/{bash/rc/prompt => profile/rc/prompt.sh} | 0 .profile | 13 ++++++++----- 9 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 .bash_profile rename .config/profile/rc/{exports => environ.sh} (85%) rename .config/{bash => profile}/rc/git-prompt.sh (100%) rename .config/profile/rc/{paths => paths.sh} (95%) rename .config/{bash/rc/prompt => profile/rc/prompt.sh} (100%) diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..f8f9564 --- /dev/null +++ b/.bash_profile @@ -0,0 +1 @@ +[ -f ~/.profile ] && source ~/.profile diff --git a/.bashrc b/.bashrc index 3294677..cef81e4 100644 --- a/.bashrc +++ b/.bashrc @@ -1,7 +1,9 @@ # User dependent .bashrc file # If not running interactively, don't do anything -[[ "$-" != *i* ]] && return +[[ -z "$PS1" ]] && return + +#[ -f /etc/bash ] && source /etc/bash; # Load settings for file in ${HOME}/.config/bash/rc/*; do diff --git a/.config/bash/rc/completion b/.config/bash/rc/completion index 11c6d16..a96031f 100644 --- a/.config/bash/rc/completion +++ b/.config/bash/rc/completion @@ -4,7 +4,7 @@ # Enable tab completion for `g` by marking it as an alias for `git` if type _git &> /dev/null; then - complete -o default -o nospace -F _git g; + complete -o default -o nospace -F _git g; fi; # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards diff --git a/.config/bash/rc/options b/.config/bash/rc/options index 22beba3..284a673 100644 --- a/.config/bash/rc/options +++ b/.config/bash/rc/options @@ -11,12 +11,9 @@ shopt -s cdspell; # * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux` # * Recursive globbing, e.g. `echo **/*.txt` for option in autocd globstar; do - shopt -s "$option" 2> /dev/null; + shopt -s "$option" 2> /dev/null; done; -# File creation -umask 022 - # Don't use ^D to exit set -o ignoreeof set -o vi diff --git a/.config/profile/rc/exports b/.config/profile/rc/environ.sh similarity index 85% rename from .config/profile/rc/exports rename to .config/profile/rc/environ.sh index 4e7c412..fbd8d35 100644 --- a/.config/profile/rc/exports +++ b/.config/profile/rc/environ.sh @@ -1,7 +1,12 @@ - -# Make vim the default editor -export EDITOR="vim"; -export VISUAL="vim"; +export USERNAME=$LOGNAME +export HOSTNAME=`hostname` +#echo Welcome $USERNAME. You are on Server: $HOSTNAME !!! + +# Set defaults +export SHELL=bash +export EDITOR=vim; +export VISUAL=vim; +export PAGER=less #export MYVIMRC="$HOME/.config/vim/vimrc" # Larger bash history (allow 32³ entries; default is 500) @@ -11,9 +16,9 @@ export HISTCONTROL=ignoreboth; # Make some commands not show up in history export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"; export HISTFILE="$HOME/.cache/bash/history"; + # Whenever displaying the prompt, write the previous line to disk export PROMPT_COMMAND="history -a"; - # Prefer US English and use UTF-8 # export LANG=$(locale -uU) export LANG="en_US.UTF-8"; diff --git a/.config/bash/rc/git-prompt.sh b/.config/profile/rc/git-prompt.sh similarity index 100% rename from .config/bash/rc/git-prompt.sh rename to .config/profile/rc/git-prompt.sh diff --git a/.config/profile/rc/paths b/.config/profile/rc/paths.sh similarity index 95% rename from .config/profile/rc/paths rename to .config/profile/rc/paths.sh index c3cf39a..90ef4d1 100644 --- a/.config/profile/rc/paths +++ b/.config/profile/rc/paths.sh @@ -1,7 +1,7 @@ # Set PATH so it includes user's private bin if it exists if [ -d "${HOME}/bin" ] ; then - PATH="${HOME}/bin:${PATH}" + PATH=.:${HOME}/bin:${PATH} fi # Set MANPATH so it includes users' private man if it exists diff --git a/.config/bash/rc/prompt b/.config/profile/rc/prompt.sh similarity index 100% rename from .config/bash/rc/prompt rename to .config/profile/rc/prompt.sh diff --git a/.profile b/.profile index 6a67f4f..6c6dcfe 100644 --- a/.profile +++ b/.profile @@ -3,14 +3,17 @@ # This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login # exists. -# Run scripts -for file in ${HOME}/.config/profile/rc/*; do - [ -f "$file" ] && source "$file"; -done; +#[ -f /etc/profile ] && source /etc/profile + +# the default umask is set in /etc/profile; +umask 022 # if running bash if [ -n "${BASH_VERSION}" ]; then - # source the users bashrc if it exists [ -f "${HOME}/.bashrc" ] && source "${HOME}/.bashrc" fi +# set path, environment, prompt etc +for file in ${HOME}/.config/profile/rc/*; do + [ -f "$file" ] && source "$file"; +done; -- 2.43.0