This repository contains a simple shell emulator implemented in Python. The shell provides basic functionalities such as executing built-in commands, navigating the filesystem, and running external commands.
-
Built-in Commands:
echo: Prints the provided message to the console.pwd: Displays the current working directory.cd: Changes the current working directory. Supports relative, absolute, and home directory paths.type: Displays the type of a command (builtin or external).exit: Exits the shell. Optionally accepts0as an argument for a clean exit.
-
External Command Execution:
- Executes commands found in directories listed in the
PATHenvironment variable.
- Executes commands found in directories listed in the
-
Clone the repository:
git clone https://github.com/<username>/python-shell-emulator.git cd python-shell-emulator
-
Run the shell emulator
python shell_emulator.py -
Interact with the shell by typing commands:
$ echo Hello, World! Hello, World! $ pwd /home/user/python-shell-emulator $ cd .. $ pwd /home/user $ type echo echo is a shell builtin -
Exit the shell:
$ exit 0
- Python 3.x
- Limited to basic command-line functionalities.
- Assumes a Unix-like environment (e.g., Linux, macOS) for PATH handling and command execution.
- Does not handle advanced shell features like pipes, redirection, or background processes.
Contributions are welcome! Feel free to fork the repository and submit a pull request for improvements or new features.
This project is licensed under the MIT License. See the LICENSE file for details.
bash Copy code $ exit 0