Giter Site home page Giter Site logo

tinyshell's Introduction

Tiny Shell

C/C++ CI

Additional features

  1. In my shell one can execute several commands at once (commands are sparated by ;)

For example:

echo 123 ; echo 5 | base64 ; echo lalal5 | base64 | base64 -d
  1. If any of the commands in a command with pipe fails to run, then the all the processes created by the command line will be terminated if we run the shell with -k flag. For example
./shell -k

This is the default behaviour of fish shell. If -k is not passed then the command will still be run and added to the job control (we may use ctrl-c to terminate it if it is in foreground). This is the default behavior of bash shell and dash shell etc.

Files

Header files are in /include; source files are in /src

To compile the shell

Firstly mkdir -p build && cd build then cmake .. then make.

To run the shell

After building the shell, run

./shell

./shell -h will print the usage.

To bring a program foreground:

tsh> fg <jobid>

for example (I did not remove the & at the end since I found that bash does not remove it either)

tsh> jobs
0: sleep 20 &
1: sleep 30 &
tsh > fg 0

There is also

tsh> bg <jobid>

Others

cd, pipe, background & foreground (jobs, fg, bg), exit are implemented. errors are handled the job control for commands with pipe is also well implemented.

TODO

  • Full unit test and mock test.
  • Simple job queue implementation.
  • Autocompletion.

tinyshell's People

Contributors

awaited-hare avatar nobles5e avatar

Watchers

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