Created
January 21, 2021 09:55
-
-
Save osa1/23e5527e0f341141c3d494091ffa1759 to your computer and use it in GitHub Desktop.
This file contains 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
chpwd() { | |
local new_dir=${$(pwd)#${HOME}/} | |
if [[ $new_dir == $HOME ]]; then | |
echo "Returning to home" | |
return | |
fi | |
local shell_file_path=$HOME/shells/$new_dir.zsh | |
if [[ -e $shell_file_path ]]; then | |
echo "Shell file found for $new_dir, creating new shell with $shell_file_path" | |
env zsh -c "source ${shell_file_path}; zsh -i" | |
else | |
echo "Shell file not found for $new_dir" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment