Shell Switcher is a snall Shell script designed to easily switch between different Shell profiles. It allows for quick changes to your shell configuration without the need to manually edit configuration files and sourcing them.
- Display a list of available profiles
- Show the currently active profile
- Switch between profiles
- Create a backup of the current
.*rcfile before changing profiles
- ZSH shell
- ZSH profiles saved as
.zshrc_profile_*files in the user's home directory
- Copy the script content into a file, e.g.,
zsh_toggle.zshfor ZSH Switcher - Make the script executable:
chmod +x /path/to/zsh_toggle.zsh
- Create ZSH profiles by saving them as
.zshrc_profile_*files in your home directory. - In each profile, add the
ZSH_TOGGLE_NAMEenvironment variable:export ZSH_TOGGLE_NAME="Your ZSH Profile Name" - Add an alias to your main
.zshrcfile to easily call the script:alias toggle_zsh='/path/to/zsh_toggle.zsh'
- Call the script by typing in the terminal:
toggle_zsh - Choose the number of the profile you want to activate, or press 'q' to exit without changes.
- The script creates a backup of the current
.zshrcfile before changing profiles (as.zshrc.bak). - If the
ZSH_TOGGLE_NAMEvariable is not defined in a profile, the full profile filename will be displayed. - After changing the profile, the ZSH session will be automatically reloaded.
- If you don't see any profiles, make sure you've created
.zshrc_profile_*files in your home directory. - If profile names are not displayed correctly, check if you've defined the
ZSH_TOGGLE_NAMEvariable in each profile file.
MIT