Code Monkey home page Code Monkey logo

simple_shell's Introduction

๐Ÿš Welcome to Our Simple_Shell. We Hatim and Omar recently completed a lightweight and efficient command-line shell program built with the C programming language! ๐Ÿ’ป

Overview ๐Ÿ“

๐Ÿ–ฅ๏ธ Simple Shell provides a user-friendly interface for executing commands and managing your system. It is a restricted shell that adheres to the list of allowed functions and system calls provided below. With simplicity and efficiency in mind, Simple Shell offers a reliable shell experience while utilizing only the allowed functions and system calls.

Features โœจ

โšก๏ธ Simple Shell comes with the following features:

  • Command execution: Enter commands and execute them seamlessly.
  • Command-line arguments: Pass arguments to executables for enhanced functionality.
  • Environment variable management: Easily manage environment variables for your shell sessions.
  • "exit" command: Use the "exit" command to gracefully exit the shell.

Dependencies ๐Ÿ“ฆ

๐Ÿ”ง Simple Shell has the following dependencies:

  • main.h: Header file containing function prototypes and necessary library includes.
  • main.c : Function serves as the entry point for the program. It continuously reads user input, tokenizes it, and executes the corresponding command using the aforementioned functions. The shell provides a prompt ($) to indicate readiness for user commands.
  • functions.c : The file that hold the functions that will be called in the main.c.
  • str.c strr.c : Files containing function definition for our own forbiden functions and system calls(strcat, strlen, ...).

Functionality ๐Ÿ”

โš™๏ธ Simple Shell leverages several functions to provide its functionality:

  • env: Duplicates the environment variables, ensuring seamless management.
  • freeEnviron: Frees the duplicated environment variables, preventing memory leaks.
  • removeTrailingNewline: Removes trailing newline characters, ensuring clean input handling.
  • tokenizeCommandLine: Tokenizes command lines into individual arguments for accurate execution.
  • executeCommand: Executes commands with the given arguments for efficient processing.
  • performFork: Performs a fork to create child processes and execute commands within them.

The main function serves as the entry point for the program. It continuously reads user input, tokenizes it, and executes the corresponding command using the aforementioned functions. The shell provides a prompt ($) to indicate readiness for user commands.

Flowchart ๐Ÿ“‹

โš™๏ธ Here a flow chart that illustrate, in an easy way, how the our Simple_Shell works:

title

How to Try It Locally ๐Ÿš€

๐Ÿ“‹ To get started with Simple Shell, follow these steps:

  1. Clone the repository and navigate to the project directory.
git clone https://github.com/RyuzakiiL23/simple_shell.git
cd simple_shell
  1. Compile the program.
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
  1. Run the shell.
./hsh
  1. Once the shell is running, you can start entering commands and executing them.
$ ls
file1.txt  file2.txt  folder1  folder2
  1. Enjoy the power and convenience of Simple Shell! Feel free to explore various commands and features.

  2. To exit the shell, simply use the "exit" command.

$ exit

Contributing ๐Ÿค

๐ŸŒŸ Contributions to this project are greatly appreciated. If you find any issues or have ideas for new features, feel free to submit a pull request. We welcome collaboration and value your input!

Contributors ๐Ÿ‘ฅ

This project is a collaboration between:

๐ŸŽ‰ We are grateful make it that far and bringing our own Simple_Shell to life ๐Ÿ˜Š!

simple_shell's People

Contributors

ryuzakiil23 avatar hatimsel avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

hatimsel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.