The Shell_v2 repository contains files from my version of Shell, but a second version more advanced to Simple_shell, which is a UNIX shell based on bash and Sh. This is my command line version of the interpreter it is written in C language.
This shell starts reading .hshrc and then optionally reads the first argument represented by a file and executes all internal commands. Then it prints a prompt and starts reading the commands. And what's more, it creates a history per command inserted.
- Commands inside the path.
| Command | Description |
|---|---|
| env | Prints Environment |
| whoami | Display the effective user ID |
| clear | Clears the terminal screen |
| cd | Changes the working directory |
| pwd | Prints the name of the current working directory |
| exit | Exits the program with a status code |
| setenv | Set a value in the Environment |
| unsetenv | Unset a value in the Environment |
| history | Prints the command history |
| help | Prints the help manual |
| alias | Prints alias |
| PS1 | Changes the prompt |
- Redirections:
n>Right stream redirection (n is a file descriptor).>>Double right stream redirection (Append).<Left stream redirection.<<Heredoc (Double left stream redirection).
- Logical operators:
&&Handle the AND logical operator||Handle the OR logical operator
- Separator:
;Handle the commands separator.
- Comments:
#Handle comments.
- Variables:
$?Status Code$$Currend PID(Process ID)$variableHandles an Environment variable like$PATH
- Signal:
^CCtrl + C
Usage: hsh
- Shell_v2 is started with the standard input connected to the terminal. To start, compile all .c located in this repository by using this command:
$ make all
$ ./hsh [File optional]#Cisfun:~/holbertonschool-shell_v2$ echo Hello ; echo World
Hello
World
#Cisfun:~/holbertonschool-shell_v2$ cd
#Cisfun:~$ cd /tmp
#Cisfun:/tmp$ pwd
/tmp
#Cisfun:/tmp$ cat -e << Heredoc
Hello
This is a document
Which is inserted into the standard input
to cat command with the e option
Heredoc
Hello$
This is a document$
Which is inserted into the standard input$
to cat command with the e option$Please, read the AUTHORS file


