The 42sh is our end of first year project at Epitech. We have to reproduce a shell based on tcsh with redirections, pipes, separators and environment
After reproducing the minimal requirements we had carte blanche to have fun and implement new features (some basics of them are strongly suggested)
Here is what we implemented:
-
@ [variable[=[expression]]]
Assign the
expressiontovariable -
@ variable++
Increment
variableby 1. -
@ variable--
Decrement
variableby 1.Note : please notice that we temporary remove the variable replacement in command-line parsing in order to prevent some crashes. We are currently fixing it.
-
alias [name [command]]
Assign
nameas alias forcommandIfnameis omitted print all alias -
alias [rm [name]]
-
unalias [name]
Remove the alias on
name -
builtins
Display all builtins
-
cd [-|dir]
Change working directory to
dirIf-is the first arg returns to the previous working directory -
chdir [-|dir]
Same as
cd -
echo [-n] string
Write string to stdout. If
-nis specified the output is not terminated by a newline. -
exit [num]
Exit the shell whith an exit value of
numIfnumis unspecified exit with a status of zero -
fg [jobID]
bring the current
jobIDto the foreground -
history [d|del|delete [num]] [clear]
List all commands in history If a
deleteoption is specified deletes thenumcommand from history Ifclearis specified clears the history -
jobs [-l]
List all running jobs If
-lspecified includes process id -
printenv [variable]
Print all (or one specified) environment variables and their values.
-
repeat [n command]
repeats the
commandntimes
We implemented a correcter (JARVIS corrector) in our shell. Currently, in case of wrong command, this corrector suggest the closest correct command or argument to the user input.
In the future we may improve this corrector to make it more performing.
Originally, we also wanted to implement a bigger feature : JARVIS micro. Thanks to the Google API Speech, our shell should have been able to be controlled only with voice (nevertheless keeping the classical command-line).
However, time played a crucial role in the development of this project, and in order to release our 42sh before the deadline, we gave up the JARVIS micro feature. But not forever...
Important: No CPU was abused during the development of this project.