An open API service indexing awesome lists of open source software.

https://github.com/minightdev/simple_shell

A custom shell implemented in C that supports executing commands, handling environment variables, and built-in commands like setenv, unsetenv, exit, and echo. It provides a basic interactive shell interface where you can enter commands and receive output.
https://github.com/minightdev/simple_shell

c-lang custom-shell shell

Last synced: 9 months ago
JSON representation

A custom shell implemented in C that supports executing commands, handling environment variables, and built-in commands like setenv, unsetenv, exit, and echo. It provides a basic interactive shell interface where you can enter commands and receive output.

Awesome Lists containing this project

README

          

# Custom Shell

A custom shell implemented in C that supports executing commands, handling environment variables, and built-in commands like `setenv`, `unsetenv`, `exit`, and `echo`. It provides a basic interactive shell interface where you can enter commands and receive output.

## Features

- Execute external commands and handle built-in commands.
- Environment variable management with `setenv` and `unsetenv` commands.
- Handle special environment variables like `$?` and `$$`.
- Replace environment variables in strings using the `$` syntax.
- Basic error handling and memory management.

## Usage

The custom shell supports basic shell commands and built-in commands. You can execute external commands and use the built-in commands by typing them into the shell.

## Compiling

To compile the shell, run

```bash
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh

```

Example of built-in commands:
- `echo [text]`: Display text to the console.
- `setenv [variable] [value]`: Set or update an environment variable.
- `unsetenv [variable]`: Remove an environment variable.
- `exit [status]`: Exit the shell with an optional status code.

To execute external commands, simply type the command name followed by any required arguments.

## Notes

- Built-in commands are handled within the shell program.
- Environment variable expansion is supported using `$VARNAME` syntax.

Feel free to explore this custom shell implementation according to your needs!