This script allows users to interactively add or delete paths from the PATH
environment variable for both Zsh (~/.zshrc
) and Bash (~/.bashrc
). The script prompts the user to choose their operating system and then provides options for manipulating the PATH
variable.
Setup to run from anywhere in the system.
# Clone the repository
git clone https://github.com/m14r41/LinuxEnv
cd LinuxEnv
chmod +x LinuxEnv.sh
mv LinuxEnv.sh LinuxEnv
sudo mv LinuxEnv /usr/local/bin
cd ..
rm -rf LinuxEnv
-
Colorful Output:
- The script uses color codes for better visibility, including green for success, red for errors, yellow for prompts, and blue for informational messages.
-
ASCII Art:
- The script begins with an ASCII art representation of a Linux terminal, providing a visually appealing introduction.
-
Add and Delete Paths:
- Allows the user to add a new path to the
PATH
variable or delete an existing path for both Zsh and Bash.
- Allows the user to add a new path to the
-
Input Validation:
- Checks whether the specified directory exists before adding or deleting a path.
- Provides error messages if the specified directory does not exist.
-
Interactive Shell Check:
- Checks if the shell is running interactively before sourcing the configuration file (
.zshrc
or.bashrc
) to avoid errors when executed non-interactively.
- Checks if the shell is running interactively before sourcing the configuration file (
-
Operating System Choice:
- Asks the user to choose their operating system (Kali Linux or Parrot OS) at the beginning of the script.
- Routes the user to the appropriate section based on their operating system choice.
-
Dynamic Menus:
- Presents dynamic menus based on the user's choice, allowing them to choose between adding or deleting a path.
-
Readable Code Structure:
- The code is well-structured with functions for each major task, improving readability and maintainability.
- The script is divided into logical sections for Zsh and Bash operations.
-
Error Handling:
- Provides clear error messages in case of invalid choices, non-existent directories, or issues with configuration files.
-
Interactive User Prompts:
- Uses
read
to interactively prompt the user for input, enhancing the user experience.
- Uses
-
Operating System Validation:
- Checks the user's choice for the operating system and handles errors for invalid choices.
-
User and Author Information:
- Displays the author's name (Madhurendra Kumar) and a tag (m14r41) in the ASCII art section.
Note:
Ensure that you have appropriate permissions to modify the configuration files (~/.zshrc
or ~/.bashrc
).