Skip to content

Commit

Permalink
refactor: use HISTFILE path for bash,zsh when defined
Browse files Browse the repository at this point in the history
  • Loading branch information
axonasif committed Sep 3, 2022
1 parent 67df02d commit 584ad0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ USER gitpod
RUN sudo echo "Running 'sudo' for Gitpod: success" && \
# create .bashrc.d folder and source it in the bashrc
mkdir -p "$HOME/.bashrc.d" && \
printf '\n%s\n' 'for s in "$HOME/.bashrc.d/"*; do source "$s"; done 2>/dev/null || :' >> "$HOME/.bashrc" && \
printf '\n%s\n' 'shopt -s nullglob; for s in "$HOME/.bashrc.d/"*; do source "$s"; done; shopt -u nullglob' >> "$HOME/.bashrc" && \
# create a completions dir for gitpod user
mkdir -p "$HOME/.local/share/bash-completion/completions"

Expand Down
5 changes: 2 additions & 3 deletions base/bashrc.d/persist_hist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ if test -e "$GITPOD_REPO_ROOT" && test ! -v HIST_PERIST_INIT && export HIST_PERI
# Taken from https://github.com/axonasif/dotfiles/blob/34c8663cac2656cdfb0ade40bcf6317c97cc239d/src/config/shell.sh#L7
function config::shell::persist_history() {
local -r _shell_hist_files=(
# Not going to use HISTFILE env var for bash and zsh
"$HOME/.bash_history"
"$HOME/.zsh_history"
"${HISTFILE:-"$HOME/.bash_history"}"
"${HISTFILE:-"$HOME/.zsh_history"}"
"$HOME/.local/share/fish/fish_history"
)

Expand Down

0 comments on commit 584ad0b

Please sign in to comment.