Simple Unix Shell. Release date August 26, 2021
- Description
- Environment
- File Structure
- Requirements
- Installation
- Usage
- Feature
- Workflow
- Example of Use
- Bugs
- Staff
- License
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)
Language: C Compiler: gcc 9.3.0
Style guidelines: Betty style
-
Files with general information about the program:
- LICENSE - Terms of license to use this project
- AUTHORS - List of contributors to this repository.
- man_simple_shell - Manual page for the simple_shell
-
/img dir:
- img - directory with support images for README.md
-
Header file with all prototypes function:
- shell.h - Header file with fuction prototypes
-
strings:
- s_putchar.c - print a character
- s_puts.c - write a string
- s_strcat.c - concatenate two strings
- s_strcmp.c - compare two strings
- s_strcpy.c - copy a string to another
- s_strlen.c - get length of a string
- s_word_count.c - count words in a string
- s_worddelimcount.c - count a serie of characters in a string
-
prompt of the shell:
-
hsh - the executable to run the shell
-
Main functions for the life time shell:
-
hsh_shell.c - The main function
-
hsh_read_line.c - get the input from standard input
-
hsh_execute.c - launch functions to execute the command
-
hsh_launch_child.c - launch child process
-
hsh_tokenize.c - tokenize the argument line
-
hsh_runcommand.c - run the command if found in the path
-
hsh_set_env.c - return the environment variables tokenized
-
hsh_getenv.c - get the environment variable
-
hsh_fullpath.c - tokenize the path
-
built-in commands:
-
b_help.c - display help
-
b_exit.c - exit the shell
-
b_cd.c - change the directory
- 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
The simple_shell is designed to execute commands in a similar manner to sh, (see man page for complete information on usage):
- uses the PATH
- implements builtins
- handles command line arguments
- shell continues upon Crtl+C (^C)
- exit - exit the shell
- cd - change directory
- help - display help
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
Not known bugs at the moment
Ayrton & Fabiana & Ronald
Ayrton
Fabiana
Ronald
This simple_shell is under Apache license. Feel free to contribute to this repo.