abbith/bash/README.org

70 lines
2.0 KiB
Org Mode

#+TITLE: Bash Config
#+PROPERTY: header-args+ :mkdir p yes
#+PROPERTY: header-args+ :tangle ~/.bashrc
Export =SHELL= to child processes. Programs such as ~screen~
honor it and otherwise use ~/bin/bash~
#+begin_src bash
export SHELL
#+end_src
We are being invoked from a non-interactive shell. If this is an
SSH session (as in =ssh host command=), source ~/etc/profile~ so we
get =PATH= and other essential variables.
#+begin_src bash
if [[ $- != *i* ]]
then
[[ -n "$SSH_CLIENT" ]] && source /etc/profile
return
fi
#+end_src
Make sure we have the system-wide config.
#+begin_src bash
source /etc/bashrc
#+end_src
Adjust the prompt depending on wheather we're in a [[https://guix.gnu.org/manual/en/html_node/Invoking-guix-environment.html][guix environment]].
#+begin_src bash
if [ -n "$GUIX_ENVIRONMENT" ]
then
PS1='\u@\h \w [env]\$ '
else
PS1='\u@\h \w\$ '
fi
#+end_src
* History
By default, Bash write its history at the end of each session, overwriting the existing file with an updated version.
This means if multiple bash session are open, only the last one to exit will have its history saved.
#+begin_src bash
shopt -s histappend
#+end_src
Most of the time the following commands just clutter up history or obscures usefull entries. Ignore the following commands
#+begin_src bash
export HISTIGNORE='exit:ls:ll:cd:pwd:bg:fg:history'
#+end_src
* Aliases
#+begin_src bash
alias ls='ls -p --color=auto'
alias ll='ls -l'
alias grep='grep --color=auto'
#+end_src
* Variables
#+begin_src bash
export BROWSER=vimb
#+end_src
Guix
#+begin_src bash
export GUIX_PROFILE="$HOME/.guix-profile"
export GUIX_PACKAGE_PATH="$HOME/Source/bbbsd"
export GUILE_LOAD_PATH="$HOME/.guix-profile/share/guile/site/2.2${GUILE_LOAD_PATH:+:}${GUILE_LOAD_PATH}"
export GUILE_LOAD_COMPILED_PATH="$HOME/.guix-profile/share/guile/site/2.2/site-ccache${GUILE_LOAD_COMPILED_PATH:+:}${GUILE_LOAD_COMPILED_PATH}"
export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
#+end_src