aboutsummaryrefslogtreecommitdiffstats
path: root/bash
diff options
context:
space:
mode:
authorjason2023-11-13 20:25:12 -0700
committerjason2024-04-02 18:03:30 -0600
commit2e1f10a9fc1f31723022ca61418353abb1efe83f (patch)
treed7d6e956e8a629999754d76147b4651757ddc72b /bash
parent248de0782a4b91fb3d4a94e1059e04857437c2b7 (diff)
downloaddotfiles-2e1f10a9fc1f31723022ca61418353abb1efe83f.tar.gz
dotfiles-2e1f10a9fc1f31723022ca61418353abb1efe83f.zip
toward posix standard bashrc for ksh
Diffstat (limited to 'bash')
-rw-r--r--bash/.bashrc99
1 files changed, 52 insertions, 47 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index 4efeb31..4c3a902 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -13,61 +13,63 @@ END_PS1="\$\[\e[m\] "
13#PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]\$\[\e[m\] " 13#PS1="[\u@\[\e[38;5;148m\]\h\[\e[m\]:\[\e[36m\]\W\[\e[m\]\[\e[m\]]\[\e[m\]\$\[\e[m\] "
14PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}" 14PATH="${HOME}/bin:${HOME}/.local/bin:${PATH}"
15 15
16# OpenBSD
16# FreeBSD 17# FreeBSD
17# Darwin 18# Darwin
18# Linux 19# Linux
19OS_NAME=`uname` 20OS_NAME=`uname`
20 21
21# Disable bash deprecation warning on OS X 22# Disable bash deprecation warning on OS X
22export BASH_SILENCE_DEPRECATION_WARNING=1 23if [ "$OS_NAME" == "Darwin" ]; then
23 24 export BASH_SILENCE_DEPRECATION_WARNING=1
25fi
24# Disable AWS SAM Telemetry 26# Disable AWS SAM Telemetry
25export SAM_CLI_TELEMETRY=0 27export SAM_CLI_TELEMETRY=0
26 28
27# Enable starship if possible 29# Enable starship if possible
28STARSHIP=`which starship 2> /dev/null` 30STARSHIP=`which starship 2> /dev/null`
29if [[ -x $STARSHIP ]]; then 31if [ -x "$STARSHIP" ]; then
30 eval "$(starship init bash)" 32 eval "$(starship init bash)"
31fi 33fi
32 34
33# Enable flutter 35# Enable flutter
34if [ -d $HOME/bin/flutter/ ]; then 36if [ -d "$HOME/bin/flutter/" ]; then
35 PATH="${HOME}/bin/flutter/bin:${PATH}" 37 PATH="${HOME}/bin/flutter/bin:${PATH}"
36 export CHROME_EXECUTABLE=chromium 38 export CHROME_EXECUTABLE=chromium
37fi 39fi
38 40
39# Enable android studio 41# Enable android studio
40if [ -d $HOME/bin/android-studio/bin ]; then 42if [ -d "$HOME/bin/android-studio/bin" ]; then
41 PATH="${HOME}/bin/android-studio/bin:${PATH}" 43 PATH="${HOME}/bin/android-studio/bin:${PATH}"
42 export JAVA_HOME="${HOME}/bin/android-studio/jre" 44 export JAVA_HOME="${HOME}/bin/android-studio/jre"
43fi 45fi
44 46
45# Set the AndroidSDK path 47# Set the AndroidSDK path
46if [ -d $HOME/.AndroidSDK ]; then 48if [ -d "$HOME/.AndroidSDK" ]; then
47 export ANDROID_SDK_ROOT=$HOME/.AndroidSDK/ 49 export ANDROID_SDK_ROOT=$HOME/.AndroidSDK/
48 PATH=$HOME/.AndroidSDK/tools/bin:$PATH 50 PATH=$HOME/.AndroidSDK/tools/bin:$PATH
49fi 51fi
50 52
51# Erlang/Kerl 53# Erlang/Kerl
52KERL=`which kerl 2> /dev/null` 54KERL=`which kerl 2> /dev/null`
53if [ -x $KERL ]; then 55if [ -x "$KERL" ]; then
54 if [ -f $HOME/.config/bash_completions/kerl ]; then 56 if [ -f $HOME/.config/bash_completions/kerl ]; then
55 source $HOME/.config/bash_completions/kerl 57 . $HOME/.config/bash_completions/kerl
56 fi 58 fi
57 if [[ $OS_NAME == "Darwin" ]]; then 59 if [ "$OS_NAME" == "Darwin" ]; then
58 export KERL_BUILD_BACKEND="git" 60 export KERL_BUILD_BACKEND="git"
59 export KERL_CONFIGURE_OPTIONS="--disable-hipe --without-javac --with-dynamic-trace=dtrace" 61 export KERL_CONFIGURE_OPTIONS="--disable-hipe --without-javac --with-dynamic-trace=dtrace"
60 fi 62 fi
61 if [[ $OS_NAME == "Linux" ]]; then 63 if [ "$OS_NAME" == "Linux" ]; then
62 export KERL_BUILD_BACKEND="git" 64 export KERL_BUILD_BACKEND="git"
63 export KERL_CONFIGURE_OPTIONS="--without-javac --with-dynamic-trace=systemtap" 65 export KERL_CONFIGURE_OPTIONS="--without-javac --with-dynamic-trace=systemtap"
64 fi 66 fi
65fi 67fi
66if [ -d $HOME/.virtualenvs/erlang ]; then 68if [ -d "$HOME/.virtualenvs/erlang" ]; then
67 source ~/.virtualenvs/erlang/activate 69 . ~/.virtualenvs/erlang/activate
68fi 70fi
69ERL=`which erl 2> /dev/null` 71ERL=`which erl 2> /dev/null`
70if [ -x $ERL ]; then 72if [ -x "$ERL" ]; then
71 # +pc unicode Output strings as unicode by default 73 # +pc unicode Output strings as unicode by default
72 # -kernal shell_history enabled Enable erl repl history 74 # -kernal shell_history enabled Enable erl repl history
73 export ERL_AFLAGS="+pc unicode -kernel shell_history enabled" 75 export ERL_AFLAGS="+pc unicode -kernel shell_history enabled"
@@ -77,16 +79,16 @@ fi
77# if [ -x $HOME/.cargo/bin/cargo ]; then 79# if [ -x $HOME/.cargo/bin/cargo ]; then
78# PATH="${HOME}/.cargo/bin:${PATH}" 80# PATH="${HOME}/.cargo/bin:${PATH}"
79# fi 81# fi
80if [ -f $HOME/.cargo/env ]; then 82if [ -f "$HOME/.cargo/env" ]; then
81 source "$HOME/.cargo/env" 83 source "$HOME/.cargo/env"
82fi 84fi
83 85
84# Enable nodejs 86# Enable nodejs
85if [ -d /usr/local/lib/nodejs ]; then 87#if [ -d /usr/local/lib/nodejs ]; then
86 NJS_VERSION=v16.8.0 88# NJS_VERSION=v16.8.0
87 NJS_DISTRO=linux-x64 89# NJS_DISTRO=linux-x64
88 PATH=/usr/local/lib/nodejs/node-$NJS_VERSION-$NJS_DISTRO/bin:$PATH 90# PATH=/usr/local/lib/nodejs/node-$NJS_VERSION-$NJS_DISTRO/bin:$PATH
89fi 91#fi
90 92
91# Enable go 93# Enable go
92if [ -d /usr/local/go/bin ]; then 94if [ -d /usr/local/go/bin ]; then
@@ -99,13 +101,14 @@ fi
99 101
100DOCKER_PATH=`which docker 2> /dev/null` 102DOCKER_PATH=`which docker 2> /dev/null`
101PODMAN_PATH=`which podman 2> /dev/null` 103PODMAN_PATH=`which podman 2> /dev/null`
102if [[ -n $PODMAN_PATH ]]; then 104#echo $PODMAN_PATH
103 source <(podman completion bash) 105#if [ -n "$PODMAN_PATH" ]; then
104 # Enable docker if it's podman 106# source <(podman completion bash)
105 if [ -z $DOCKER_PATH ]; then 107# # Enable docker if it's podman
106 alias docker=podman 108# if [ -z $DOCKER_PATH ]; then
107 fi 109# alias docker=podman
108fi 110# fi
111#fi
109 112
110# Enable docker completions on OS X 113# Enable docker completions on OS X
111if [ -n $DOCKER_PATH ] && [ -d /Applications/Docker.app/Contents/Resources/etc/ ]; then 114if [ -n $DOCKER_PATH ] && [ -d /Applications/Docker.app/Contents/Resources/etc/ ]; then
@@ -124,7 +127,7 @@ fi
124 127
125# Enable nix 128# Enable nix
126if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; then 129if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; then
127 source $HOME/.nix-profile/etc/profile.d/nix.sh 130 . $HOME/.nix-profile/etc/profile.d/nix.sh
128fi 131fi
129 132
130####### 133#######
@@ -137,22 +140,24 @@ if [ -x /opt/homebrew/bin/brew ]; then
137 #export LDFLAGS="-L/opt/homebrew/lib" 140 #export LDFLAGS="-L/opt/homebrew/lib"
138 #export CPPFLAGS="-I/opt/homebrew/include" 141 #export CPPFLAGS="-I/opt/homebrew/include"
139 eval "$(/opt/homebrew/bin/brew shellenv)" 142 eval "$(/opt/homebrew/bin/brew shellenv)"
140fi
141 143
142# Enable bash-completions for homebrew installed bash 144 # Enable bash-completions for homebrew installed bash
143if [ -f /opt/homebrew/etc/bash_completion ]; then 145 if [ -f /opt/homebrew/etc/bash_completion ]; then
144 . /opt/homebrew/etc/bash_completion 146 . /opt/homebrew/etc/bash_completion
145fi 147 fi
146 148
147# Enable pyenv 149
148if [ -x /opt/homebrew/bin/pyenv ]; then 150 # Enable pyenv
149 # Prevent linking against system libpython when building 151 if [ -x /opt/homebrew/bin/pyenv ]; then
150 alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew' 152 # Prevent linking against system libpython when building
151 export PYENV_ROOT="$HOME/.pyenv" 153 alias brew='env PATH="${PATH//$(pyenv root)\/shims:/}" brew'
152 export PATH="$PYENV_ROOT/bin:$PATH" 154 export PYENV_ROOT="$HOME/.pyenv"
153 eval "$(pyenv init --path)" 155 export PATH="$PYENV_ROOT/bin:$PATH"
154 eval "$(pyenv init -)" 156 eval "$(pyenv init --path)"
157 eval "$(pyenv init -)"
158 fi
155fi 159fi
160
156if [[ -x /usr/local/bin/pyenv || -x $HOME/bin/pyenv ]]; then 161if [[ -x /usr/local/bin/pyenv || -x $HOME/bin/pyenv ]]; then
157 # FreeBSD, probably linux 162 # FreeBSD, probably linux
158 eval "$(pyenv init -)" 163 eval "$(pyenv init -)"
@@ -163,7 +168,7 @@ __workon() {
163} 168}
164__mkvirtualenv() { 169__mkvirtualenv() {
165 python -mvenv ~/.virtualenvs/$1 170 python -mvenv ~/.virtualenvs/$1
166 source ~/.virtualenvs/$1/bin/activate 171 . $HOME/.virtualenvs/$1/bin/activate
167} 172}
168alias workon=__workon 173alias workon=__workon
169alias mkvirtualenv=__mkvirtualenv 174alias mkvirtualenv=__mkvirtualenv
@@ -187,7 +192,7 @@ if [ -f /etc/bash_completion ]; then
187fi 192fi
188 193
189## FreeBSD 194## FreeBSD
190[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \ 195[[ -n $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] && \
191 source /usr/local/share/bash-completion/bash_completion.sh 196 source /usr/local/share/bash-completion/bash_completion.sh
192 197
193if [[ $OS_NAME == "FreeBSD" || $OS_NAME == "OpenBSD" ]]; then 198if [[ $OS_NAME == "FreeBSD" || $OS_NAME == "OpenBSD" ]]; then
@@ -212,8 +217,8 @@ fi
212 217
213## OpenBSD 218## OpenBSD
214if [ -f /usr/local/share/fzf/bash/key-bindings.bash ]; then 219if [ -f /usr/local/share/fzf/bash/key-bindings.bash ]; then
215 source /usr/local/share/fzf/bash/key-bindings.bash 220 . /usr/local/share/fzf/bash/key-bindings.bash
216 source /usr/local/share/fzf/bash/completion.bash 221 . /usr/local/share/fzf/bash/completion.bash
217fi 222fi
218 223
219## TCL/TK via homebrew 224## TCL/TK via homebrew
@@ -239,14 +244,14 @@ alias e="${EDITOR}"
239#export HISTTIMEFORMAT="[%F %T] " 244#export HISTTIMEFORMAT="[%F %T] "
240export HISTSIZE=99999 # Store unlimited entries. Default: 500 245export HISTSIZE=99999 # Store unlimited entries. Default: 500
241export HISTFILESIZE=999999999 # Unlimited file size 246export HISTFILESIZE=999999999 # Unlimited file size
242#shopt -s histappend # append entries rather than overwrite
243shopt -s cmdhist # Store multi-line commands as a single line
244# Store history immediately 247# Store history immediately
245## history -r rereads 248## history -r rereads
246export PROMPT_COMMAND="history -a;history -r; ${PROMPT_COMMAND}" 249export PROMPT_COMMAND="history -a;history -r; ${PROMPT_COMMAND}"
247#export PROMPT_COMMAND="history -a; ${PROMPT_COMMAND}" 250#export PROMPT_COMMAND="history -a; ${PROMPT_COMMAND}"
248export HISTCONTROL="ignoredups" 251export HISTCONTROL="ignoredups"
249export HISTIGNORE="ls:cd" 252export HISTIGNORE="ls:cd"
253shopt -s histappend # append entries rather than overwrite
254shopt -s cmdhist # Store multi-line commands as a single line
250 255
251# Aliases 256# Aliases
252#alias ls='ls --color' 257#alias ls='ls --color'
@@ -259,7 +264,7 @@ alias define='sdcv'
259 264
260# Enable direnv (https://github.com/direnv/direnv/) 265# Enable direnv (https://github.com/direnv/direnv/)
261DIRENV=`which direnv 2> /dev/null` 266DIRENV=`which direnv 2> /dev/null`
262if [[ -x $DIRENV ]]; then 267if [ -x "$DIRENV" ]; then
263 eval "$(direnv hook bash)" 268 eval "$(direnv hook bash)"
264fi 269fi
265show_virtual_env() { 270show_virtual_env() {