747-diego/simple_shell

Diego Tardio

Software Engineer
Bash
C
GitHub

SIMPLE SHELL

Recreate a simple shell for Holberton. This assignment tasks us to build a shell which outputs exactly as the sh shell.

Prerequisites

Only use the following functions and system calls:

Environment

Simple Shell was built and tested in the Ubuntu 14.04 LTS via Vagrant in VirtualBox and compiled with GCC version 4.8.4

Respository Contents

Simple Shell files:
File Description holberton.h Header file that contains all the functions and standard C library header files needed prompt.c Contains the int main(void) function, entry point and prompt_handler _strtok.c Contains function that store commands in double pointer: find_command_length, array_from_strtok helpers.c Contains all helper functions: _strncpy,_strncpyconst, _strlen_const, _strcmp,_strlen habitat.c Contains all functions that handle environment/path: find_semis, store_env_variables, _getenv, _strncpycmd, print_env free_all.c Contains function that frees memory: free_all errors.c Contains functions that handle error messages: build_error_message, _puterror, end_of_file, fork_fail childs_play.c Contains functions that handle all child proccess functionality: command_is_null, exit_out, env_out, parent_free_buff_commands, create_path

How to Install

To do

Mandatory

Handle EOF
Parser interprets exit -- Currently, if the first 4 characters of the string are exit, the shell will exit.
Handle path
Build env function

Advanced

exit handles arguments to exit -- What is exit status 4?

Parser

Handle ^C (CTRL + C) -- Find the signal and change its behavior.
Handle ;
Handle &&, and ||
Handle # Comments

Recreate standard library functions

getline
strtok
getenv
setenv
unsetenv

Shell Builtins

register builtins before executing commands
cd
alias
help
history
Deal with variables
Scripts as input

Bugs

unfreed mallocs somewhere. (Check with Valgrind.)
Only delimiters handled are spaces and newlines.

Authors

Diego Tardio
Partner With Diego
View Services

More Projects by Diego