Minishell is a simple shell implementation that allows users to interact with their operating system through a command-line interface. It supports various features such as command execution, history management, redirections, pipes, environment variable expansion, and more.
- Display a prompt when waiting for a new command.
- Maintain a working history for previously entered commands.
- Search and launch the right executable based on the PATH variable or using a relative or absolute path.
- Avoid using more than one global variable to indicate a received signal, ensuring signal handlers do not access main data structures.
- Do not interpret unclosed quotes or special characters not required by the subject (e.g., backslash or semicolon).
- Handle single quotes (
') to prevent the shell from interpreting meta-characters in the quoted sequence. - Handle double quotes (
") to prevent the shell from interpreting meta-characters in the quoted sequence except for$(dollar sign).
<should redirect input.>should redirect output.<<should read input until a line containing the specified delimiter without updating the history.>>should redirect output in append mode.
- Implement pipes (
|) where the output of each command in the pipeline is connected to the input of the next command via a pipe.
- Handle environment variables (
$) that expand to their values.
- Handle
$?, which expands to the exit status of the most recently executed foreground pipeline.
- Handle
ctrl-Cto display a new prompt on a new line. - Handle
ctrl-Dto exit the shell. - Handle
ctrl-\with no specific action.
echowith option-ncdwith only a relative or absolute pathpwdwith no optionsexportwith no optionsunsetwith no optionsenvwith no options or argumentsexitwith no options
- Heredoc expands environment variables.
- Colored prompt to indicate whether the last status code was 0 or not.
- If Minishell is launched without an environment, it creates one that includes:
SHLVL,_,PATH,PWD.
Compile the program using the provided Makefile:
makeRun Minishell:
./minishellmake: Compile the program.make all: Same asmake.make clean: Remove object files.make fclean: Remove object files and the executable.make re: Rebuild the program from scratch.
readline,rl_clear_history,rl_on_new_line,rl_replace_line,rl_redisplay,add_history,printf,malloc,free,write,access,open,read,close,fork,wait,waitpid,wait3,wait4,signal,sigaction,sigemptyset,sigaddset,kill,exit,getcwd,chdir,stat,lstat,fstat,unlink,execve,dup,dup2,pipe,opendir,readdir,closedir,strerror,perror,isatty,ttyname,ttyslot,ioctl,getenv,tcsetattr,tcgetattr,tgetent,tgetflag,tgetnum,tgetstr,tgoto,tputs
Libft functions are authorized for use.
Feel free to explore and enjoy the Minishell experience!