Giter Site home page Giter Site logo

shell's Introduction

Shell

A simple shell in C built for an OS class that supports pipes and basic history.

Test Run

~/Desktop/shell$ ./w4118_sh
$/bin/ls
demo_run.txt  Makefile    README.md  shell.c  shell.h  tester.py    w4118_sh  written.txt
$/bin/cat Makefile | /usr/bin/wc
     26      53     487
$/bin/cat Makefile | /usr/bin/wc -l | /usr/bin/wc -l
1
$/usr/bin/uptime
 20:31:39 up 9 min,  2 users,  load average: 0.00, 0.04, 0.05
$/bin/pwd
/home/w4118/Desktop/shell
$cd /tmp
$/bin/pwd
/tmp
$history
0 /bin/ls
1 /bin/cat Makefile | /usr/bin/wc
2 /bin/cat Makefile | /usr/bin/wc -l | /usr/bin/wc -l
3 /usr/bin/uptime
4 /bin/pwd
5 cd /tmp
6 /bin/pwd
$history 3
 20:35:08 up 13 min,  2 users,  load average: 0.00, 0.02, 0.05
$history c
$history
$exit

Memory Leaks check

~/Desktop/shell$ make valgrind
gcc -g -o w4118_sh shell.c -Wall -W
valgrind --leak-check=full --show-leak-kinds=all ./w4118_sh
==3074== Memcheck, a memory error detector
==3074== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==3074== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==3074== Command: ./w4118_sh
==3074==
$/bin/ls
demo_run.txt  Makefile    README.md  shell.c  shell.h  tester.py    w4118_sh  written.txt
$/bin/ls | /usr/bin/wc -l
8
$history
0 /bin/ls
1 /bin/ls | /usr/bin/wc -l
$history -c
$exit
==3074==
==3074== HEAP SUMMARY:
==3074==     in use at exit: 0 bytes in 0 blocks
==3074==   total heap usage: 21 allocs, 21 frees, 109,622 bytes allocated
==3074==
==3074== All heap blocks were freed -- no leaks are possible
==3074==
==3074== For counts of detected and suppressed errors, rerun with: -v
==3074== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

shell's People

Contributors

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