This is a simple Shell based on the Sh Linux shell. It executes commands given by the user or from a file.
You can compile the source files using $ gcc -Wall -Werror -Wextra -pedantic -std=c90 *.c -o hsh
The shell can operate in two modes, interactive and non-interactive.
In the interactive mode, you run it by typing ./hsh
and then typing your command when the prompt appears, finishing with the enter key. To exit the console in this mode, you can use the exit command or hit control + D.
In the non-interactive mode you can use a pipe to make the shell execute just one command, for example: echo ls | ./hsh
will make the shell execute the ls command and go back to your current shell.
Also, you can use ./hsh file
To execute a set of instructions from file.
File | Description |
---|---|
AUTHORS | Authors of the shell. |
README.md | Readme file for the repo. |
alias.c | Functions to handle alias creation. |
aliexpansion.c | Functions to handle alias expansion. |
atoi.c | Converts a string to a number. |
change_dir.c | Functions to handle the cd builtin. |
check_builtins.c | Checks if the command entered is a builtin. |
check_newlines.c | Checks if the command has multiple lines. |
exit.c | Exit builtin. |
expand_vars.c | Handles variable expansion. |
getenv.c | Gets an environment variable. |
getline.c | Own implementation of getline function, gets input from user. |
history.c | Functions to handle the history builtin. |
holberton.h | Header file with prototypes of functions. |
man_1_simple_shell | Manual page for our shell. |
prepare_command.c | Function that parses the input command and start the processes needed to execute it. |
print_number.c | Prints a given number. |
remove_spaces.c | Removes unnecesary spaces from the command. |
setenv.c | Functions to set and unset variables. |
shell.c | Main file of the shell, has the entry point. |
strcat.c | Concatenates two strings. |
strcmp.c | Compares two strings. |
strcpy.c | Copies one string into a memory space. |
strlen.c | Gives the length of a string. |
strncmp.c | Compares n bytes of two strings. |
strtok.c | Own implementation of strtok function. |