Simple Shell is a basic command-line interface that emulates the functionality of a Unix shell. It was developed as a part of the Alx Software Engineering Programme.
This simple shell project aims to replicate the basic functionality of a Unix shell. It provides users with a command-line interface where they can interact with their system by executing commands and running programs.
- Command execution
- Handling of built-in commands
- Environment variable manipulation
- PATH resolution for executing commands
- Introduction
- Features
- Installation
- Usage
- Built-in Commands
- File Descriptions
- Example
- Project Scope
- Contribution
- Authors
To install and run the simple shell on your system, follow these steps:
-
Clone Repository: Clone the repository to your local machine:
https://github.com/tech2world/simple_shell.git
-
Navigate to Directory: Change to the directory containing the project files:
cd simple_shell -
Compile Source Files: Compile the source files into an executable:
gcc -Wall -Werror -Wextra -pedantic *.c -o simple_shell
To use the simple shell, follow these steps:
-
Launch Shell: Run the generated executable to start the shell:
./simple_shell
-
Enter Commands: Once the shell is running, you'll be prompted with a command prompt. Enter commands as you would in a regular shell.
The shell supports the following built-in commands:
exit: Exit the shellenv: Print the current environment variablessetenv: Set a new environment variableunsetenv: Unset an environment variable
- authors: Contains a list of individuals who contributed to the project.
- README.md: Overview of the project, including its purpose, features, and usage instructions.
- builtins.c: Implementation of built-in command functions.
- builtins2.c: Additional built-in command functions.
- environment.c: Functions for managing the shell environment.
- errors.c: Functions for printing error messages and handling errors.
- memory_allocation.c: Function for reallocating memory.
- new_strtok.c: Custom implementation of
strtokfunction. - path.c: Functions for executing commands in the PATH.
- shell.h: Header file containing function prototypes and struct definitions.
- simple_shell.c: Main source file containing the entry point of the shell.
- strfunc.c: String manipulation functions.
- tokenize.c: Function for tokenizing input.
Once the Simple Shell is running, you can perform various operations such as:
- Running executable files present in the current directory.
- Listing files in the current directory using the
lscommand. - Creating directories using the
mkdircommand. - Moving files between directories using the
mvcommand. - Running processes in the background using the
&operator.
$ ls
AUTHORS environment.c memory_allocation.c README.md simple_shell.c
builtins2.c errors.c new_strtok.c shell.h strfunc.c
builtins.c file path.c simpleshell tokenize.c
$ mkdir test
$ ls
AUTHORS environment.c memory_allocation.c README.md simple_shell.c
builtins2.c errors.c new_strtok.c shell.h strfunc.c
builtins.c file path.c simpleshell testThe Simple Shell project aims to provide a basic command-line interface similar to traditional Unix shells. While it may not support all features of advanced shells like Bash or Zsh, it includes essential functionalities such as executing commands, handling built-in commands, and basic error handling.
Contributions to the Simple Shell project are welcome! If you have ideas for improvements or bug fixes, feel free to open an issue or submit a pull request on GitHub.
- Abdulazeez Ibrahim abdulazeezibrahim847@gmail.com
- Tejumade Adedoyin