dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit aa1acef56faaf5530221328799a5a5cb8f2fe178 (patch)
parent ad59384cc58aec3c7095218a4406b614c4b637d3
Author: Alex Karle <alex@karle.co>
Date:   Mon, 20 Jan 2020 23:44:18 -0500

sh: move .profile -> .shrc for proper startup

Just like the bash_profile, ~/.profile is only sourced by login shells.
We set the ENV env var to ~/.shrc, so that POSIX shells will go on to
then source that file (which had the contents of ~/.profile previously).

Interactive shells (not login shells) will read $ENV for their startup
configuration.

Diffstat:
Mbash/bashrc | 2+-
Msh/profile | 32++++----------------------------
Ash/shrc | 28++++++++++++++++++++++++++++
3 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/bash/bashrc b/bash/bashrc @@ -20,7 +20,7 @@ aw() { w3m "https://wiki.archlinux.org/index.php?search=$1"; } ddg() { w3m "https://duckduckgo.com/lite?q=$1"; } include() { [ -r "$1" ] && source "$1"; } -include "$HOME/.profile" # Common shell configuration +include "$HOME/.shrc" # Common shell configuration include "$HOME/.bash/git-completion.bash" # Git Completion include "$HOME/.console_theme" # Virtual Console colors (if TERM == "linux") include "$HOME/.bashrc.local" # System specific settings diff --git a/sh/profile b/sh/profile @@ -1,29 +1,5 @@ #!/bin/sh -# ~/.profile -- the sh profile -# To be used as a base for all other shell rc's -[ -z "$PS1" ] && return - -# Crucial exports -PATH=$HOME/bin:$PATH # Put ~/bin on the for personal scripts -EDITOR='vi' # $EDITOR, the most important (personal) of exports -VISUAL='vi' # Some programs give priority to this - -# Build up a somewhat fancy prompt (with SSH and error code indicators!) -if [ -n "$SSH_CLIENT" ]; then - SSH_PROMPT="[$USER@$(hostname)] " -fi - -last_err() { - err="$?" - if [ $err -ne "0" ]; then - echo "[$err] " - fi -} - -PS1='$(last_err)$PWD $SSH_PROMPT -$ ' -PS2="> " - -export PATH EDITOR VISUAL PS1 PS2 SSH_PROMPT - -[ -r "$HOME/.aliases" ] && . "$HOME/.aliases" +# ~/.profile -- dash/sh/ksh profile +# Sourced for login shells -- set $ENV to ~/.shrc +# to use that as the config for this and all new interactive shells +export ENV="$HOME/.shrc" diff --git a/sh/shrc b/sh/shrc @@ -0,0 +1,28 @@ +#!/bin/sh +# ~/.shrc -- a config for all POSIX shells +[ -z "$PS1" ] && return # Exit early if non-interactive + +# Crucial exports +PATH=$HOME/bin:$PATH # Put ~/bin on the for personal scripts +EDITOR='vi' # $EDITOR, the most important (personal) of exports +VISUAL='vi' # Some programs give priority to this + +# Build up a somewhat fancy prompt (with SSH and error code indicators!) +if [ -n "$SSH_CLIENT" ]; then + SSH_PROMPT="[$USER@$(hostname)] " +fi + +last_err() { + err="$?" + if [ $err -ne "0" ]; then + echo "[$err] " + fi +} + +PS1='$(last_err)$PWD $SSH_PROMPT +$ ' +PS2="> " + +export PATH EDITOR VISUAL PS1 PS2 SSH_PROMPT + +[ -r "$HOME/.aliases" ] && . "$HOME/.aliases"