Welcome to the Robert-Martin Simple Shell Project
this shell can be compiled and run from the command line, it includes basic features, as well as some advanced features found in most shell programs.
The prototype of our main function is as follows:
int main(int argc __attribute__((unused)), char **argv, char **env);
The header file is called holberton.h
where all the function prototypes, structures and libraries used in our shell are referenced.
- git clone this repository to your local machine.
$ git clone https://github.com/sebascastel/simple_shell
cd
intosimple_shell/
directory.
$ cd simple_shell/
- Compile the program.
$ gcc -Wall -Werror -Wextra -pedantic *.c -o hsh
or
$ make
- Execute the Shell's Bells !
$ ./hsh
Note: Shell's Bells can also be run in non-interactive mode:
$ echo "/bin/ls" | ./hsh
This Shell, has a familiar syntax when running commands, as other common Shells:
†Shell's Bells†<command> <flags>
- non-interactive mode:
$ echo "<command>" | ./hsh
interactive mode
ls
command:
†Shell's Bells†ls -1
pwd
command:
†Shell's Bells†pwd
cd
command:
†Shell's Bells†cd ..
help
command:
†Shell's Bells†help <builtin command>
# comments
†Shell's Bells†echo Hello # World
Hello
Our Shell supports a variety of builtin commands:
exit
- exits the Shell
env
- prints the environment variables.
setenv
- sets an environment variable.
unsetenv
- unsets an environment variable.
cd
- changes directory.
help
- displays help for builtin commands.
welcome
- displays a welcome message 😄
bart
- shows Bart Simpson 😄
A short description of every file used in this project.
File Name | Description |
---|---|
AUTHORS | file containing the contributing authors |
README.md | readme file explainig wht this project is about |
_getline.c |
implementation of getline function |
_help.c |
implementation of builtin help function |
_realloc.c |
realloc reallocates memory |
_strcat.c |
function that concatenates three strings |
_strcmp.c |
compares two strings |
_strcpy.c |
copies the string pointed by src to pointer dest |
_strdup.c |
duplicates a string |
_strtok.c |
implemetation of builtin strtok function |
add_node_end.c |
adds a new node at the end of a linked list |
bart.c |
builtin function that prints bart |
bart.txt |
text file which contains ASCII bart |
cd.c |
implementation of cd builtin function |
ch_pwd.c |
changes current working directory |
colors.c |
a set of colors used to bring to life our Shell 💥 |
colors_2.c |
another set of colors |
cp_env.c |
makes a copy of the environment variables |
create_arg_list.c |
takes the input buffer and creates argument list |
delete_node_ind.c |
deletes a node at a given index |
error.c |
writes error message to standard output |
exec.c |
forks and execute command |
exit_built.c |
builtin exit function |
free_list.c |
frees memory for linked lists |
handler.c |
handles the ctrl-c key to keep looping |
help_options.c |
a collection of helper builtin functions |
holberton.h |
header file |
man_1_simple_shell |
Shell's Bells man page |
not_builtin.c |
core function of our Shell |
path.c |
searches the correct path of command and concatenates the path with '/' and command |
perm.c |
checks permisions |
print_env.c |
builtin function of env prints the environment |
search_env.c |
searches for the environment string pointed to by name |
set.c |
sets or updates environment variable builtin setenv function |
shell.c |
main fucntion of our †Shell's Bells†shell |
split.c |
takes a string and splits it into key value pair |
struct_builtin.c |
function to find builtins functions |
to_str.c |
converts an integer into a string |
unset.c |
removes environment variable builtin unsetenv function |
welcome.c |
builtin function that prints welcome message |
welcome.txt |
text file which contains ASCII welcome message |
This project was created by - Robert Castellanos and Andres Martin at Holberton School Colombia cohort 0.