simple_shell

This is an implementation of a simple UNIX command interpreter written as part of the low-level programming at ALX SWE.

Description

This is a simple UNIX sommand language interpreter that reads commands from the standard output or a file and executes the command. This simple shell is based on bash(Bourne Again shell)

Enviroment

Suite CRM OS: Ubuntu 20.04 LTS

terminal

C Low level programming language Language: C Compiler: gcc 9.3.0

Suite CRM Editor: VIM 8.1.2269

git distributed version control system Control version: Git

Github

Style guidelines: Betty style

General requirements

  • Allowed editors: vi, vim, emacs
  • All your files will be compiled on 'Ubuntu 14.04 LTS'
  • Your C programs and functions will be compiled with 'gcc 4.8.4' using the flags '-Wall -Werror -Wextra and -pedantic
  • Your code should use the Betty style. It will be checked using betty-style.pl and betty-doc.pl'
  • No more than 5 functions per file
  • All your header files should be include guarded
  • This shell should not have any memory leaks
  • Unless specified otherwise, your program must have the exact same output as sh (/bin/sh) as well as the exact same error output.

Installation

  • Fork the repository.
  • clone the repository to your local machine.
  • Change into the repository 'cd simple_shell'
  • Compile the program using the command: 'gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh'
  • Type in './hsh' to run the executable.

Files

File Description
AUTHORS Authors of the project
README.md Information about the project
_getenv.c Gets the environment variable
_strtok.c Tokenizes the string
builtins.c Builtin Commands
check_command.c Checks for command
check_prog_name.c Check for name
error.c Handles all errors
execute_all_commands.c Executes all functions
execute_cmd.c Executes single commands
get_command.c Gets a command
get_next_separator.c Grts the next separator
initialize_shell_vars.c Initializes a struct
ksh_cd.c cd command
ksh_env.c env command
khs_exit.c Exit builtin
ksh_setenv_unsetenv.c Set and unset environment variables
main.c Entry point to the program
main.h Prototypes of functions and headers.
parse_and_exec.c executes command as given
parse_command.c tokenize command entered
remove_comment.c Removes comment from command to be executed
search.c search absolute filepath
signal_handler.c Handles signals
Split_commands.c Splits a command to two srings

Contirubutors

Acknowlegdment

This program emulates some of the basic functionalities of the bash. The man pages were used extensively in the writing of this program.

This program was written as a part of the curriculum for ALX SWE.