Coder Social home page Coder Social logo

c-shell's Introduction

C-shell

An attempt to implement the C shell with all it's features

BUILTIN COMMANDS

cd and echo, both work exactly the same like the normal terminal one. That means, even using "" or '' is supported. I have not included escape characters and made different flags ( as it was mentioned in the news forum ). For example,

cd asd/"saf
> asd"  

(Reading user input again) This will go to asd/safasd OR

echo sad      asd "as
>   asd"

(Reading user input again) This will output sad asd as asd

SIGNAL HANDLING AND PIPING/REDIRECTION

All the Basic Signal Handling is done

  • Ctrl-D ( to exit the shell )
  • Ctrl-Z ( to push a process to background )
  • Ctrl-C ( to give an interrupt )

FILES

I have created four dependency files

  • changedir.c : This file basically should be renamed builtin.c because it has all the builtin commands (echo, cd, pwd). There are three functions which implements the behaviour of the commands.

  • shell_display.c : This file contains the code to display the username, hostname and the current working directory.

  • read_input.c : As the name of the file conveys, it is used read input, parse them (tokenise them) and give it to other builtin commands or execute another process

  • execute.c : This file contains pinfo (BONUS II) and executeCommand (BONUS I included) which can create a fg/bg process.

  • shell.c : This is the main file.

COMPILING AND EXECUTION

I have made a makefile which compiles each of the dependencies I have created (.c and .h files which support the main program - shell.c). The makefile creates an object file after compilation and in the end compiles all of them with the main program shell.o (because it has the main function). It creates an executable file by the name "shell"

To start the shell, just execute the "shell" executable file which is created after you use the make command (./shell)

c-shell's People

Contributors

vijeth-aradhya avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.