by Team Daniel and Nick (Cohort 22) Holberton School Australia, Melbourne
This is a simple Unix shell implementation developed as part of the curriculum at Holberton School. The shell supports both interactive and non-interactive modes, basic command execution, including built-in commands and external commands.
This is created with C (programming language) and vim (code editor).
Features
- Interactive command execution
- Non-interactive command execution
- Executing commands from a file
- Handling command arguments
- Environment variable expansion
- Error handling and exit status
- Signal handling (Ctrl+C)
- Custom prompt display
- Ubuntu 20.04 LTS
- GCC compiler
- Follows the Betty linter style and documentation
- No more than 5 functions per file
To run this project, install it locally by cloning our repository using the command git clone
as shown below:
git clone https://github.com/DanielColoradoL/holbertonschool-simple_shell
Our repository contains a makefile, and with file it allows you to compile all of the c files in the repo with simple command make
and when you do this it will create an executable called ./hsh
.
Here are some useful commands:
make
: Compile the shellmake clean
: Remove object files
When you run in interactive mode ./hsh
the outcome will be:
$ ./hsh
($) /bin/ls
hsh main.c shell.c
($)
($) exit
$
When you run in non-interactive mode, the outcome will be:
$ 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
$
The shell supports the following built-in commands:
exit
: Exit the shellenv
: Print the current environmentpwd
: Show the path of the current working directory
The shell is capable of executing external commands by searching for the corresponding executable files in the directories listed in the PATH
environment variable. It uses the execve
system call to launch external programs.
Below is a flowchart showing the basic implementation of how our hsh shell works.
To see the manual page for this hsh shell, type the following line into the command line:
man ./man_1_simple_shell
Please read the AUTHORS file for details on our code of conduct, and the process for submitting pull requests.
This Simple Shell was created for educational purposes under the framework and guidance of Holberton School, Melbourne Australia.