Skip to content

By this project we create our own simple shell. This program is a command interpretor in an operating system.

Notifications You must be signed in to change notification settings

Doniben/simple_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sin-ti-tulo-1 Simple shell

cherry72 A simple UNIX command interpreter that provides a user interface to access and give orders to the operating system.

Table of contents

Requirements

  • Ubuntu 14.04 LTS
  • gcc version 4.8.4

Instalation

  • Clone this repository:
git clone https://github.com/Doniben/simple_shell.git
  • Inside the repository, compile.
  • Execute:
./hsh
  • Or run in non-interactive mode, in this mode:
echo "ls" | ./hsh

Compilation

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

Written in

  • GNU Emacs 24.3.1
  • C language

Example of use

  • Run an executable:
$ /bin/pwd
  • Run an executable founded in the $PATH environment variable:
$ pwd
  • Run a shell built-in:
$ env

All commands and builtins that you can use are in the manual page.

Files and functions

  • main.c - File where all the main functions are called Flowchart-shell-copia

  • prompt.c - File where are the main functions to display the prompt

    • read_line - print the line
    • parsing_line - tokenize and analyze the argument
    • exec_process - execution of process
  • path.c - program header file

    • path_av - communicate the route with the command
    • ph_to_dp - function to put te path route into a double pointer
    • number_of_dir - number of directories in the route of path
  • builtin.c - Builtin functions

    • _enviro - function that prints the environmental variables
    • salto_linea - Auxiliar function for the use of the command signal
  • own_func.c - helper functions for the builtins

    • _strcmp - compare two strings
    • _strcat - concat two strings
    • _strdup - a function that duplicates a string
    • _strlen - function to return the length of a string
    • _putchar - writes the character to stdout
  • header.c - The header file

  • man_1_simple_shell - Manual page for the simple_shell

  • AUTHORS - List of contributors to this repository

Authors

About

By this project we create our own simple shell. This program is a command interpretor in an operating system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages