Giter Site home page Giter Site logo

my_zsh's Introduction

My_zsh (UNIX Shell)

Authors: Chris Dallat (www.github.com/chrisdallat), Khalil Masree (www.github.com/khalilmasree)

Task Description

Your interpreter will display a prompt: $> (for example)

You will have to wait for a command line to be written (ending by a newline character (enter))

You will have to parse the command line and format it in order to execute it.

The prompt must be displayed again only after the command execution.

For the execution you must use execve.

Only basic command lines are expected to be executed; no pipes, redirections or any other advanced features. The executables should be those found in the path, as indicated in the PATH variable.

If the executable cannot be found, you must display an error message and display the prompt again. Errors must be dealt with and must display the appropriate message on the error output. You must correctly handle the PATH and the environment (by copying and restoring the initial env).

You must implement the following builtins:

  • Echo
  • cd
  • setenv
  • unsetenv
  • env
  • exit
  • pwd
  • which

Program Usage

1. Type "make" to compile the program.

 make

2. You can then run the program with "./my_zsh" to run the shell and a prompt ">" will appear then user can use following built-ins:

 * exit
 
      'exit' will exit ./my_zsh
 * echo:
 
      'echo $[VARNAME]' will return the value of environment variables if they exist (case sensitive)
      'echo "anything"' will return the strings entered without quotations.
 * cd
 
      'cd ..' will move back in the path
      'cd /' will move to /
      'cd -' will move back to original file position
      'cd [dirname]' will move to directory if it exists
 * pwd
 
      'pwd' will print the path of the current working directory
 * env
 
      'env' will output the environment to terminal
 * setenv
 
      'setenv $[VARNAME] [VALUE]' will set an environment variable and value. 
      Variable names must be uppercase and Variable and value must be separated by a single space.
 * unsetenv
 
      'unsetenv $[VARNAME]' will remove environment variable if it is found in environment
 * which 
 
      'which' will identify the location of binary executables, 
      for built-in functions it will produce a message declaring such
 or binary executables and their arguments:
      * touch
      * ls
      * etc....
 compiling '*.c' files with 'make' command followed by the filename without the '.c' extension 
 and subsequently executing the executable with './[FILENAME]
 
 e.g file: main.c
      >'make main'
      >'./main'
      
 **NOTE: Two test '.c' files have been left in main folder for behavior examples of a functioning program 
 and a segfaulting program!!! 

3. You can clean up '.o' files by typing the following command after usage

      'make clean'

my_zsh's People

Contributors

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