ralexrivero / simple_shell

Simple shell for Unix project in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

simple_shell

Simple Unix Shell. Release date August 26, 2021 Twitter

GitHub code size in bytes Lines of code

Table of Contents

Description

simple_shell is a command interpreter that uses funtions and system calls to execute programs stored in the O.S. Standard C functions and system calls employed for this simple_shell:

  • access (man 2 access)
  • chdir (man 2 chdir)
  • execve (man 2 execve)
  • exit (man 3 exit)
  • fork (man 2 fork)
  • free (man 3 free)
  • getline (man 3 getline)
  • isatty (man 3 isatty)
  • malloc (man 3 malloc)
  • perror (man 3 perror)
  • signal (man 2 signal)
  • strtok (man 3 strtok)
  • wait (man 2 wait)
  • write (man 2 write)

Environment

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

File Structure

Installation

  • Clone this repository: git clone "https://github.com/ralexrivero/simple_shell"
  • Change directories into the repository: cd simple_shell
  • Compile: gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
  • Run the shell in interactive mode: ./hsh
  • Or run the shell in non-interactive mode: example echo "Hello world!" | ./hsh

Usage

The simple_shell is designed to execute commands in a similar manner to sh, (see man page for complete information on usage):

Workflow

image image

Features

  • uses the PATH
  • implements builtins
  • handles command line arguments
  • shell continues upon Crtl+C (^C)

Builtins

  • exit - exit the shell
  • cd - change directory
  • help - display help

Example of Use

First compile and then run the executable file on your terminal For compile see Installation section

$ ./hsh
$
$ ls -l
total 22
-rwxrwxrwx 1 user user   206 Aug 23 21:11 AUTHORS
-rwxrwxrwx 1 user user   479 Aug 25 11:31 b_cd.c
-rwxrwxrwx 1 user user   190 Aug 25 11:31 b_exit.c
-rwxrwxrwx 1 user user   585 Aug 25 11:31 b_help.c
-rwxrwxrwx 1 user user  1131 Aug 25 11:35 hsh_execute.c
-rwxrwxrwx 1 user user   727 Aug 25 11:55 hsh_launch_child.c
-rwxrwxrwx 1 user user   426 Aug 25 11:49 hsh_read_line.c
-rwxrwxrwx 1 user user   711 Aug 25 12:17 hsh_shell.c
-rwxrwxrwx 1 user user  1301 Aug 25 12:04 hsh_tokenize.c
drwxrwxrwx 1 user user     0 Aug 23 21:11 img
-rwxrwxrwx 1 user user 11357 Aug 23 21:11 LICENSE
-rwxrwxrwx 1 user user  1091 Aug 23 21:11 man_1_simple_shell
-rwxrwxrwx 1 user user  6471 Aug 25 12:44 README.md
-rwxrwxrwx 1 user user   749 Aug 25 11:30 shell.h
drwxrwxrwx 1 user user  4096 Aug 24 20:03 simple_shell_03
-rwxrwxrwx 1 user user   183 Aug 25 11:30 s_putchar.c
-rwxrwxrwx 1 user user   339 Aug 25 10:04 s_puts.c
-rwxrwxrwx 1 user user 16784 Aug 25 10:56 s_strcat
-rwxrwxrwx 1 user user   628 Aug 25 10:57 s_strcat.c
-rwxrwxrwx 1 user user   325 Aug 25 10:02 s_strcmp.c
-rwxrwxrwx 1 user user   282 Aug 25 10:02 s_strlen.c
-rwxrwxrwx 1 user user   276 Aug 25 12:14 s_word_count.c

Bugs

Not known bugs at the moment

Staff

Ayrton & Fabiana & Ronald

Ayrton

Ayrton Coelho | LinkedIn

Ayrton | Github

Fabiana

Fabiana Tellechea | LinkedIn

Fabiana | Github

Ronald

Ronald Rivero | Twitter

Ronald Rivero | LinkedIn

Ralex | Github


License

This simple_shell is under Apache license. Feel free to contribute to this repo.

About

Simple shell for Unix project in C

License:Apache License 2.0


Languages

Language:Shell 55.7%Language:C 44.3%