https://github.com/tlmader/mash
Mash, a simple shell using the POSIX system call API
https://github.com/tlmader/mash
c redirection shell stream
Last synced: about 1 year ago
JSON representation
Mash, a simple shell using the POSIX system call API
- Host: GitHub
- URL: https://github.com/tlmader/mash
- Owner: tlmader
- Created: 2016-09-16T02:54:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-02T22:14:37.000Z (about 9 years ago)
- Last Synced: 2025-01-12T12:46:16.076Z (about 1 year ago)
- Topics: c, redirection, shell, stream
- Language: C
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mash
**Principles of Operating Systems I Programming Assignment 1**
A simple shell using the POSIX system call API.
## Getting Started
To run the project, use the following commands in the terminal:
1. `make`
2. `./mash.exe`
## Prompt
Once started, the user will be given a prompt that shows the current working directory (e.g.: `/home/csci4401>`), and the shell enters an infinite loop where it takes user commands and executes them.
## Built-in Commands
Mash implements the `cd` and `pwd` commands that allow a user to change the current directory and to print the current directory, respectively. The exit command allows orderly shell exit.
## Simple Program Execution
Unless the user types in a built-in command, any other input will be interpreted as an effort to run an executable. In response, Mash will `fork()` a process, execute the command and show the output (e.g.: `ls -l`).
## Stream Redirection
Mash allows redirection of standard input/output streams to/from a file. E.g:
* `ls -l > output`
* `sort alice.txt > sorted.txt o sort < alice.txt > sorted.txt`
## Pipes
Mash allows IPC via pipes. E.g.: `ls -l | grep sh | wc -l`