Giter Site home page Giter Site logo

simple-c-shell's Introduction

CShell

Implementing a simple shell in C designed to run on a linux based system

Commands: • calc expr. - prints out the result of the mathematical prefix expression that comes after the command. • time - prints out the current local time and date • path - prints out the current working directory • sys - prints the name and version of the OS and CPU type • put dirname filename(s) [-f] – put files filenames in the directory dirname • get filename - prints the content of the file filename to the screen • quit - ends the program

Notes: • If the command is not one of the above, you should print an error message and wait for a new command. • You can assume the expression after the calc command is a valid prefix expression containing only ‘+’ and ‘–‘ signs. You can also assume a space character separates any two numbers/signs. e.g. “+ + 2 3 - 4 5”. • Note that if you want to use the prefixadd() function from week 2 workshop you will need to store the expression as a ragged array of strings. • time – you can use the functions defined in <time.h> (link). Hint: look at time(), localtime() and asctime() functions. • path - you can use the linux system function getcwd() (link). • put - The put command will create a new directory called dirname and copy the file (or files) listed in the command, in this directory. If the directory exists you should only print an error message, unless -f has been specified, in which case the directory will be completely overwritten (old content is deleted). If a file(s) doesn’t exist, you will need to print a ‘file not found’ message for that file. • get - The get command will dump the file contents to the screen 40 lines at a time and pause, waiting for a key to be pressed before displaying the next 40 lines etc.

simple-c-shell's People

Contributors

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