An implementation of a UNIX shell with advanced features.
- Command execution and piping
- Input/output redirection
- Environment variable management
- History with navigation
- And many more...
This shell integrates with the OpenAI ChatGPT API. Type your query and press Ctrl+I to send it to ChatGPT and receive the response directly in your terminal.
Before building, you'll need to install the required dependencies:
This will install the necessary libraries (libcurl and libjson-c).
To build the shell:
make./42shThe shell supports secure environment variable configuration through a .env file for storing sensitive API keys.
-
Copy the example file to create your own environment file:
cp .env.example .env
-
Edit the
.envfile with your actual API keys:nano .env
-
Add your OpenAI API key:
OPENAI_API_KEY=your_actual_api_key_here
The .env file is automatically ignored by Git to prevent accidentally committing sensitive information.
- Never commit your
.envfile to version control - Restrict the file permissions:
chmod 600 .env - Don't share your API keys with others
- Rotate your API keys periodically for enhanced security
- Type your query in the shell prompt
- Press
Ctrl+Ito send it to ChatGPT - The response will be displayed in the terminal
Credit to Louis BAGNOL, Gabriel BRUMENT, Louis PUJOL, Gabin SCHIRO