The shell is a command that reads lines from either a file or the terminal, interprets them, and generally executes other commands. Â It is the program that is running when a user logs into the system (although a user can select a different shell with the chsh(1) command). The shell implements a language that has flow control constructs, a macro facility that provides a variety of features in addition to data storage, along with built in history and line editing capabilities. dash(1) - Linux man page
Code files must be compiled this way:
$ gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
The Simple Shell should work like this in interactive mode (simple commands can be typed directly to the running shell):
$ ./hsh
($) /bin/ls
hsh main.c shell.c
($)
($) exit
$
And also in non-interactive mode (commands can be put into a file and the file can be executed directly):
$ echo "/bin/ls" | ./hsh
hsh main.c shell.c test_ls_2
$
$ cat test_ls_2
/bin/ls
/bin/ls
$
$ cat test_ls_2 | ./hsh
hsh main.c shell.c test_ls_2
hsh main.c shell.c test_ls_2
$
- 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
- All your files should end with a new line
- A README.md file, at the root of the folder of the project is mandatory
- Your code should use the Betty style. It will be checked using betty-style.pl and betty-doc.pl
- Your shell should not have any memory leaks
- No more than 5 functions per file
- All your header files should be include guarded
- Use system calls only when you need to why?
stdarg.h | signal.h | unistd.h | sys/wait.h | stdlib.h | sys/stat.h
File | Description |
---|---|
simple_shell.h |
Libraries, declarations. |
builtin.c |
Search and init built-ins |
errormessages.c |
Messages Handlers |
execute.c |
Create and execute processes |
freeall.c |
Free memory |
getenv.c |
Get environment variables |
pathappend.c |
Append program to its path |
searchinit.c |
Execute local programs, redirect commands |
searchpathfile.c |
Search and validate file paths |
splitarguments.c |
Count arguments and breaks them into tokens |
str_handlers.c |
String Handlers Funcs |
hsh.c |
Main Function |