Skip to content

ToqYang/simple_shell

 
 

Repository files navigation

logo

Simple-Shell

simple-shell is a interpreter command-line between kernel and the user mode for it can use the resources of the Operative System. This program is done, how final project of trimester of Holberton school for consolidate the theory and practice of the C programming language.

commands

Functions

File Description
holberton.h Contain all the libraries and functions created by us
aux_func.c handler - handles ctrl + c signal, exec_path - check if executable exists on directory
error.m_.c error_message - compose the standar error message, error_helper - sends char to write
free_.c free_em_all - will free double pointer, print_env - prints all of the environment variables to the output, free_listint - free list and sets head to NULL
get_path get_path - will searh if command exist on any of PATH's directories
list_maker.c list_maker - add node initialize it and give it a string, free_list - free list and sets head to NULL, listint_len - list nodes of a list
shell_1.c shell_1 - Initiliaze the proccess and execute
shell_.c main - Initialization of the shell!
s_strings.c s_strdup - duplicate a string, s_length - determine lenght of string, s_strcopy - copy n bytes from one string to another, strcmpn - compares n bytes in two strings slash - append slash and comannd to directory in linked list
tokenizer.c tokens - Divide a string with delimiter into tokens

Objectives

  • manpage - Technical manual about the simple shell
  • Display:
  • The posible command to enter "ls"
  • Wait and hear to other command for example; "pwd"
  • After the mini-shell follow a new line "\n".
  • Print the $ at the init for know if is inside of the shell and after wait to the follow command, if the user doesn't write exit or EOF.
  • If executable not is found with stat, print a error message and return error with POSIX.
  • Handle errors in case that some function fail to execute
  • Handle the EOF "End of File" the which verify
  • Handle mode non-interactive
  • exit builtin - It does that the program end the proccess
  • env builtin that print the current enviroment

Requeriments

  • Ubuntu 14.04 LTS or greater
  • gcc 4.8.4

Install

  1. Clone this repository: git clone "https://github.com/Teslothorcha/simple_shell"
  2. Change directories into the repository: cd simple_shell
  3. Compile: gcc with flags
  4. Execute ./nameofexecutable

Install

Modes of execute shell

Interactive mode:

Interactive-mode

Non-Interactive mode:

Non-Interactive

Blog

  • What happens when you type ls -l in the shell:

https://medium.com/@ToqYang/what-happens-when-you-type-ls-l-in-the-shell-d28b88e70ae1?source=friends_link&sk=f91a8687d9b25b68d1788259faa950b5

How make your own ManPage

https://medium.com/@ToqYang/how-write-your-own-manpage-d0d3b6528775?source=friends_link&sk=751b24abdf5878af303f7f2f6a753d1f

Flow Chart

My-First-Board

Social

Juan David @Teslothorcha Twitter Follow

Santiago Yanguas @TYGames3 Twitter Follow

About

This a simple shell built in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%