This project is a custom shell implemented using Bash and enhanced with Python to demonstrate various operating system-related features. The shell supports command history, environment variable management, command aliases, and the ability to handle chaining, piping, and redirection.
- Command History: Stores and displays previously executed commands.
- Environment Variables: Set and display environment variables.
- Aliases: Create, list, and remove aliases for commands.
- Command Chaining (
&&): Execute multiple commands sequentially, stopping if one fails. - Piping (
|): Redirect the output of one command as input to another. - Redirection (
>,>>): Redirect command output to files. - Background Jobs (
&): Execute commands in the background. - Directory Navigation (
cd): Change the current working directory. - Website Opening: Open a URL in the default browser with
open <URL>. - Help: Provides a list of available commands.
To use this custom shell, you must have Bash and Python installed. Ensure that you have access to xdg-open for opening URLs.
-
Clone the repository:
git clone https://github.com/yourusername/custom-shell.git
-
Navigate to the project directory:
cd custom-shell -
Run the shell:
./myshell.sh
Once the shell starts, you can use the following commands:
history- Display the command history.env- Show the current environment variables.set VAR VALUE- Set an environment variable.alias name command- Create a command alias.alias -l- List all aliases.unalias name- Remove an alias.cd <directory>- Change the directory.open <URL>- Open a website in the browser.help- Display this help message.exit- Exit the shell.
You can chain commands together using &&:
$ ls && echo "Directory listed"You can pipe the output of one command into another using |:
$ ls | grep "file"Redirect the output of a command to a file using > for overwriting or >> for appending:
$ echo "Hello, World" > output.txt
$ echo "Appended text" >> output.txtYou can run commands in the background using &:
$ long_running_command &You can create command aliases to shorten repetitive commands:
$ alias ll="ls -l"
$ ll # Executes ls -lTo remove an alias:
$ unalias ll- This project was created as part of an Operating Systems course.
- Thanks to the community for open-source contributions and tutorials that helped guide the development of this shell.