Skip to content

Ineffable22/holbertonschool-shell_v2

Repository files navigation

Shell v2 By Ineffable

Overview

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.

He designed and implemented the original Unix operating system.

Description

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

Path commands

  • Commands inside the path.

Built-in

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

Advance commands

  • 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)
    • $variable Handles an Environment variable like $PATH
  • Signal:
    • ^C Ctrl + C

Compilation

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]

Example

#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$

Author

Please, read the AUTHORS file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published