/simple_shell

this projects aims to create a simple UNIX command interpreter using C programing language

Primary LanguageC

0x16. C - Simple Shell

📄 🚀

Description

This project represents a milestone in the C code curriculum at ALX Africa Software Engineering, focusing on the implementation of a shell.
Referred to as the "Gates of Shell," this project is a part of the first trimester and serves as a valuable learning experience for students to delve into advanced concepts such as processes, system calls, bit manipulation, file management, and error handling.
The shell created in this project mimics the functionalities of a basic UNIX command interpreter (sh).
The entire program has been crafted using the C programming language.

COPYRIGHT

Copyright (C) 2024 by Noble Biru and Brian Wagura
All rights reserved

Description :

This is a shell written in C. It is based on the Thompson Shell.

Environment :

the shell was built and tested on Ubuntu 14.04 LTS.

Features

  • Display a prompt and wait for the user to type a command. A command line always ends with a new line.
  • If an executable cannot be found, print an error message and display the prompt again.
  • Handle errors.
  • Hndling the “end of file” condition (Ctrl+D)
  • Hanling the command line with arguments
  • Handle the PATH
  • Support the exit features

Builtins

Our shell has support for the following built-in commands:

Command Definition
exit Exit the shell
env Print the environment.
setenv [var][value] Set an environment variable and value. If the variable exists, the value will be updated.
alias[name[='value]] Reads aliases name
unsetenv [var] Remove an environment variable.
cd [dir] Change the directory.
help [built-in] Read documentation for a built-in.

Installation : Getting HSH

Clone the below repository and compile the files into an executable using the GCC compiler.

https://github.com/noble-ch/simple_shell.git

Basic usage 💡

  • First, Fork this Repository Learn how to fork repo.
  • Then Clone Learn how to clone .
  • Create an executable by running the following command:
  • gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
  • From there, type in the following command and press your enter button.
  • ./hsh
  • Final step: ENJOY!

Example 💻

ls -la

114757753-e50c2180-9d64-11eb-95ea-fb9bba776c8c

Contributors :

Acknowledgments :

  • The creators of the C language.
  • Our software engineer-in-residence.
  • Betty Holberton | Alx-Africa.