Skip to content

PilarPinto/simple_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Shell Project

Creating our version of a command line interpreter: shell.

enter image description here

  • This repository includes our version of the Shell: simple Unix command interpreter, replicates the basic functionalities of the simple shell (sh), here we will apply the knowledge that we have acquired during the learning of the programming language C, works with the system call of the Kernel.
  • This project is requested by Holberton School.

What is the shell?

A Unix shell is a command-line interpreter or shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command language and a scripting language, and is used by the operating system to control the execution of the system using shell scripts.

This version of super simple shell support the next built-in

Command Definition
exit Exit the shell with the command exit.
env Print the environment.

Installation

Use the git clone to install this super simple shell.

git clone https://github.com/PilarPinto/simple_shell.git

Compilation

Your code will be compiled this way:

gcc -Wall -Werror -Wextra -pedantic *.c -o hsh

This project works in two different modes, the interactive mode and the non interactive mode.

With the compilation create an executable file that can use to emulate the simple shell like this in interective mode:

$ ./hsh
($) /bin/ls
hsh main.c shell.c
($)
($) exit
$

And also you can emulate the simple shell like this in non-interactive mode:

$ echo "/bin/ls" | ./hsh
hsh main.c shell.c test_ls_2
$
$ cat test_ls_2
/bin/ls
/bin/ls
$
$ cat test_ls_2 | ./hsh
hsh main.c shell.c test_ls_2
hsh main.c shell.c test_ls_2
$

Usage Examples

In the terminal, our version of the simple shell looks like this:

$ /bin/ls -l
drwxrwxr-x 1 vagrant vagrant 279 Nov 20 03:14 README.md
drwxrwxr-x 2 vagrant vagrant 165 Nov 20 23:46 arguments.c
$ /bin/pwd
/home/vagrant/test_my_own_shell
$ hhhhh
Does not execute, write valid command: No such file or directory

Contributing

You can contribute with this shell adding some buil-int functions, feel free to make pull request.

Autors

About

The implementation of a simple shell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages