Skip to content

Repository files navigation

Simple Shell

The simple shell is a command-line interpreter or shell that provides a command line user interface for Unix-like operating systems.

Description:

We create our own simple UNIX command interpreter. The program has the same output as /bin/sh as well as the exact same error output. The only difference is when you print an error, the name of the program must be equivalent to your argv[0].

Features

  • Includes exit function that exits the shell
  • Includes enviroment builtin that display the current enviroment
  • Display a prompt where the user can type a command
  • Can handle commands with arguments
  • Use the PATH variable to find and execute the command

Instructions:

How to dowloaded

Use directly this link:

https://github.com/erikaosgue/simple_shell.git

Go to you terminal and type

git clone [link you just copied]

then you will have the repository in your computer

Once you do that you can use this main template and fallow the instructions for compilation

Compilation and running

Compiling the program with:

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

Run:

In interactive mode:

 $ ./shell
($) ls
functions.c README.md shell.c
_getenv.c shell shell.h _which
($) exit
$

Non-interactive mode:

 $ echo "ls" | ./shell
functions.c README.md shell.c
_getenv.c shell shell.h _which
$

You can open a man page and get more information about it.

 user@ubuntu:~/c/printf$ **man ./man_1_simple_shell**

Usage

  1. Type ./shell in your shell. You should be promped with a $.
  2. Type a command and press "Enter".
  3. An ouput will appear.
  4. Type your next command if you want.
  5. Exit shell by typing "exit"

Blog:

https://medium.com/@erikaosgue/4a72ef258c3a

Files:

This repository contains the following files:

FileDescription
shell.cExecute the shell
shell.hHeader
functions.cHelper functions
_which.cFind PATH
_getenv.cFind env variable
builtins.cBuiltins functions
helper_functions.cHelper functions2
fredom.cfree pointers
family.cfork() sys call
_itoa.cconvert a int to str
shell_prompt.cDisplay prompt
cwd_inside_PATH.cFind in CWD
find_exe_cwd.cFind and execute in cwd
find_exe_cwd.cFind in PATH the argument
Path_empty.cCheck if PATH is empty
strchr.cLocates a charater in str
AUTHORSAUTHORS
exit_shell.cexit builtin

Authors:

AuthorsEmail
Bryan Builes Echavarria1482@holbertonschool.com
Erika Osorio Guerrero1476@holbertonschool.com

About

A simple Shell or command-line interpreter that provides a command line user interface for Unix-like operating systems using C programing Language.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages