https://github.com/moisam/lets-build-a-linux-shell
Repository code for the "Let's Build a Linux Shell" tutorial
https://github.com/moisam/lets-build-a-linux-shell
linux linux-shell posix posix-shell shell terminal tutorial tutorial-code
Last synced: 11 days ago
JSON representation
Repository code for the "Let's Build a Linux Shell" tutorial
- Host: GitHub
- URL: https://github.com/moisam/lets-build-a-linux-shell
- Owner: moisam
- License: gpl-3.0
- Created: 2020-06-09T13:55:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-02T07:07:21.000Z (almost 5 years ago)
- Last Synced: 2025-04-02T15:21:17.288Z (about 1 month ago)
- Topics: linux, linux-shell, posix, posix-shell, shell, terminal, tutorial, tutorial-code
- Language: C
- Homepage: https://medium.com/dev-genius/lets-build-a-linux-shell-part-i-954c95911501
- Size: 73.2 KB
- Stars: 39
- Watchers: 4
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This repository contains the source files for the "Let's Build a Linux Shell" tutorial.
# How to use the code
You need to download this repository to your computer, then compile and run the code.
## Downloading the repository
Click on the green "Clone or Download" button on the top-right, then click on "Download Zip" to save the file on your computer.
## Extracting the archive
Open a terminal emulator (GNOME Terminal, Konsole, XTerm, or what-have-you), and navigate to the directory where you downloaded the ZIP file:
```
cd ~/path/to/zip
```
Extract the archive and navigate to the extracted directory:
```
unzip lets-build-a-linux-shell-master.zip
```
## Compiling the shell
First, navigate to the directory in which you've extracted the downloaded archive:
```
cd lets-build-a-linux-shell-master/
```
If you want to compile and run the shell from Part II/III of the tutorial, you can do so by navigating to the subdirectory and then running `gcc`:
```
cd part2-3/
gcc -o shell main.c source.c scanner.c parser.c node.c executor.c prompt.c
```
If you want to compile Parts IV and above, navigate to the subdirectory and run `make`:
```
cd part4/
make
```
## Running the shell
Now you can run the shell by invoking:
```
./shell
```