From 8a70b6e6836c7394f511725a79bf7ac07bfb36c0 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Thu, 16 Nov 2023 00:14:24 +0800 Subject: Track fish manually --- .bashrc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.bashrc b/.bashrc index 35c4ea1..999df4e 100644 --- a/.bashrc +++ b/.bashrc @@ -2,6 +2,7 @@ # ~/.bashrc # +[ "$(uname)" = Darwin ] && source "$HOME/.macos" source "$HOME/.env" source "$HOME/.path" @@ -13,12 +14,13 @@ PS1='[\u@\h \W]\$ ' source "$HOME/.aliases" source "$HOME/.fzfrc" + if command -v fish > /dev/null; then - if [[ ( $(uname) == Darwin || # the ps command is not invalid in bsd - "$(ps --no-header --pid=$PPID --format=comm)" != "fish") && \ - -z ${BASH_EXECUTION_STRING} ]] + __FISH_IS_ACTIVE=${__FISH_IS_ACTIVE:-0} + if [[ -z ${BASH_EXECUTION_STRING} && $__FISH_IS_ACTIVE -eq 0 ]] then shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION='' - exec fish $LOGIN_OPTION + exec env __FISH_IS_ACTIVE=1 fish $LOGIN_OPTION fi + export __FISH_IS_ACTIVE=0 fi -- cgit v1.2.3