Giter Site home page Giter Site logo

repl's Introduction

REPL

Bash-like REPL implemented in C. Supports interactive and non-interactive mode.

Installation & Usage

gcc repl.c -o repl
./repl

Examples

mysh> name
mysh
mysh> name abrakadabra
abrakadabra>
abrakadabra>
abrakadabra> name mysh
mysh> print Simple shell
Simple shellmysh> echo No quotes
No quotes
mysh> echo "With      quotes"
With      quotes
mysh> pid
23327
mysh> ppid
21953
mysh> # comment
mysh>               # comment
mysh> help
      name - Print or change shell name
      help - Print short help
     debug - Toggle debug mode
    status - Print last command status
      exit - Exit from shell
     print - Print arguments
      echo - Print arguments and newline
       pid - Print PID
      ppid - Print PPID
       dir - Change directory
  dirwhere - Print current working directory
   dirmake - Make directory
 dirremove - Remove directory
   dirlist - List directory
dirinspect - Inspect directory
  linkhard - Create hard link
  linksoft - Create symbolic/soft link
  linkread - Print symbolic link target
  linklist - Print hard links
    unlink - Unlink file
    rename - Rename file
    remove - Remove file or directory
     cpcat - Copy file
     pipes - Create pipeline
mysh> # files
mysh> dirwhere
/home/user/repl
mysh> dirmake test
mysh> dirmake test
dirmake: File exists
mysh> linkhard .bashrc test/bash-settings
mysh> dir test
mysh> dirwhere
/home/user/repl/test
mysh> linkhard bash-settings bash-conf
mysh> linksoft bash-settings bash-conf-soft
mysh> linksoft some/directory shortcut
mysh> dirlist
bash-settings  bash-conf-soft  bash-conf  shortcut  ..  .
mysh> linklist bash-conf
bash-settings  bash-conf
mysh> dirmake delete-me
mysh> unlink delete-me
unlink: Is a directory
mysh> dirremove delete-me
mysh> unlink bash-conf
mysh> unlink bash-conf
unlink: No such file or directory
mysh> rename bash-settings bash-conf
mysh> dirlist
bash-conf-soft  bash-conf  shortcut  ..  .
mysh> # redirection
mysh> echo something >a.txt
mysh> cat a.txt
something
mysh> cpcat a.txt
something
mysh> cpcat a.txt b.txt
mysh> cat b.txt
something
mysh> cpcat - c.txt
Spring is here                  # CTRL+D to end
mysh> cat b.txt c.txt
something
Spring is here
mysh> cpcat <a.txt >d.txt
mysh> cat d.txt
something
mysh> # background processing
mysh> pid
27206
mysh> pid &
mysh> 27782

mysh> pid &
mysh> 27788

mysh> pid &
mysh> 27791

mysh> pid >pid.txt &
mysh> cpcat <pid.txt
27818
mysh> pid >pid.txt &
mysh> cpcat <pid.txt
28055
mysh> # pipelines
mysh> pipes "cat /etc/passwd" "wc -l"
249
mysh> pipes "cat /etc/passwd" "head -13" "tail -3" "wc -l"
3
mysh> exit 42

repl's People

Contributors

volkmaster avatar

Watchers

 avatar

Forkers

gsorbier

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.