Giter VIP home page Giter VIP logo

bourne_shell's Introduction

simple_shell

A custom implementation of the sh (bourne shell) in C.

 ____   _                    _           ____   _            _  _ 
/ ___| (_) _ __ ___   _ __  | |  ___    / ___| | |__    ___ | || |      
\___ \ | || '_ ` _ \ | '_ \ | | / _ \   \___ \ | '_ \  / _ \| || |      
 ___) || || | | | | || |_) || ||  __/    ___) || | | ||  __/| || |      
|____/ |_||_| |_| |_|| .__/ |_| \___|   |____/ |_| |_| \___||_||_|      
                     |_|                                                                         

Description

This is a simple implementation of a Unix shell, which is a command-line interface allowing users to interact with the operating system by entering and executing commands. The project aims to replicate some basic functionalities of the Unix shell.

Getting Started

Prerequisites

  • A Unix-like operating system (Linux, macOS, etc.)
  • GCC (GNU Compiler Collection) or any compatible C compiler

Installation

  1. Clone the repo root@laptop$ git clone https://github.com/geoffreylgv/simple_shell.git
  2. Move to the directory Run: root@laptop$ cd simple_shell
  3. Compilation
    3.1. Compilation with Makefile Type root@laptop$ make
    Run the program with root@laptop$ make run
    To clean it, run root@laptop$ make clean, it will remove the hsh program file in the directory.
    3.2. Traditional compilation Type this command : root@laptop$ gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
    Then, run ./hsh to execute the simple shell program

Features

UNIX command line interpreter

Step 1
  • Display a prompt and wait for the user to type a command. A command line always ends with a new line.
  • The prompt is displayed again each time a command has been executed.
  • The command lines are simple, no semicolons, no pipes, no redirections or any other advanced features.
  • The command lines are made only of one word. No arguments will be passed to programs.
  • If an executable cannot be found, print an error message and display the prompt again.
  • Handle errors.
  • You have to handle the “end of file” condition (Ctrl+D)
  • execve will be the core part of your Shell, don’t forget to pass the environ to it…
Step 2
  • Handle command lines with arguments
Step 3
  • Handle the PATH
  • fork must not be called if the command doesn’t exist
Step 4
  • Implement the exit built-in, that exits the shell
  • Usage: exit
  • You don’t have to handle any argument to the built-in exit
Step 5
  • Implement the env built-in, that prints the current environment

More information about bourne shell

Bourne Shell

Authors

Geoffrey Logovi | Soufyane Halloumi

bourne_shell's People

Contributors

geoffreylgv avatar soofyane avatar

Stargazers

Paul Koop avatar  avatar

Watchers

 avatar

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.