Skip to content

okesity/Unix-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unix-Shell

This is a Unix shell like "bash" called "nush". It can operates as follows:

  1. Accept an optional script file as the first command line argument.
  2. If there's no script, show a prompt. Your prompt should be "nush$ ". Command input is accepted on the same line after the prompt.
  3. Read one line of commands from either stdin or the script.
  4. Execute that line of commands.
  5. Repeat until EOF or an "exit" command.

It supports nine operators:

  • Redirect input: sort < foo.txt
  • Redirect output: sort foo.txt > output.txt
  • Pipe: sort foo.txt | uniq
  • Background: sleep 10 &
  • And: true && echo one
  • Or: true || echo one
  • Semicolon: echo one; echo two
  • Variable Assignment: FOO=one
  • Variable Use: echo $FOO

and some built in commands:

  • "cd": changes the current directory.
  • "exit": exits the shell.

and also some other important features:

  • Subshell: ((sleep 3) && echo one)
  • Quotes: echo ";)echo one"
  • Newline:
    echo \  
    one
    

About

A Unix Shell written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published