Created
July 27, 2025 08:48
-
-
Save youyoumu/ae9ba1cd53f841cc2c27a6de500adb94 to your computer and use it in GitHub Desktop.
Modify .bashrc to drop into fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env bash | |
| PARENT_PROCESS=$(ps --no-header --pid=$PPID --format=comm) | |
| # Only exec fish if: | |
| if [[ | |
| # The parent process isn't already fish | |
| $PARENT_PROCESS != "fish" && | |
| # Bash wasn't started in script mode (BASH_EXECUTION_STRING is empty) | |
| -z ${BASH_EXECUTION_STRING} && | |
| # We're at shell level 1 (SHLVL == 1) — i.e., this is the top-level shell | |
| ( ${SHLVL} -eq 1) | |
| ]] || [[ | |
| # Or we are launching bash from one these programs | |
| $PARENT_PROCESS == "kitty" || | |
| $PARENT_PROCESS == ".kitty-wrapped" || | |
| $PARENT_PROCESS == "tmux: server" | |
| ]]; then | |
| shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION='' | |
| exec fish $LOGIN_OPTION | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment