This project is a simple command-line shell (LSH) written by LordSMH in C. It supports a few built-in commands and can execute external programs.
- Built-in commands:
cd,help, andexit. - Ability to execute external programs.
- Uses system calls to create new processes (
fork()) and execute programs (execvp()).
To compile and run the program, enter the following commands in the terminal:
gcc -o lsh main.c
./lshAfter running the program, you can enter your commands. For example:
> help
> cd ..
> ls -l
> exit-
cd: Change the directory.
- Usage:
cd <directory_name> - Example:
cd /home/user
- Usage:
-
help: Display this help message.
- Usage:
help
- Usage:
-
exit: Exit the shell.
- Usage:
exit
- Usage:
main.c: The main file that contains all the necessary functions to run the shell.builtin_func[]andbuiltin_str[]: Arrays that store the built-in commands and their corresponding functions.- Built-in command functions:
cd(char **args): Changes the current directory.help(char **args): Displays help information.exit(char **args): Exits the shell.
This project was created by Lord_Smh.
This project is licensed under the MIT License - see the LICENSE file for details.