A simple shell implementation that takes bash as a reference.
- Prompt: Displays a prompt when waiting for a new command.
- History: Has a working command history.
- Command Execution: Searches and launches the right executable based on the PATH variable or using an absolute path.
- Single Quotes: Handles single quotes to prevent interpretation of meta-characters in the quoted sequence.
- Double Quotes: Handles double quotes to prevent interpretation of meta-characters, except for
$
(dollar sign). - Redirections: Implements various redirections, such as
<
,>
,<<
, and>>
. - Pipes: Implements pipes (
|
) for command pipelines. - Environment Variables: Handles expansion of environment variables (
$
) to their values. - $?: Handles
$?
to expand to the exit status of the most recently executed foreground pipeline. - Ctrl-C, Ctrl-D, Ctrl-: Implements behavior similar to bash for these control signals.
- Builtins: Implements several built-in commands:
echo
,cd
,pwd
,export
,unset
,env
, andexit
.
Note: It does not interpret unclosed quotes or special characters that are not mentioned above.
To get started with Minishell, follow these steps:
- Clone the repository:
git clone https://github.com/damachad/42_minishell.git
- Navigate to the project directory:
cd minishell
- Build the project:
make
- Run Minishell:
./minishell
Note: Make sure you have the required libraries installed, such as readline.
$ ls -l > outfile.txt
$ cd ..
$ pwd
$ echo "Hello, Minishell!"
$ << EOF cat | wc
$ env
$ export MY_VARIABLE="42"
$ echo $MY_VARIABLE
$ exit 2