2025-05-23 17:22:04 +02:00
2025-05-05 15:12:49 +02:00
2025-02-23 23:37:53 +01:00
2025-04-27 18:44:43 +02:00
2025-05-23 17:22:04 +02:00
2025-05-22 15:23:15 +02:00
2025-05-09 00:28:10 +02:00
2025-04-28 20:53:21 +02:00
2025-05-05 15:05:49 +02:00
2025-04-20 17:04:54 +02:00
2025-05-22 20:46:34 +02:00
2025-05-18 19:15:08 +02:00
2025-04-24 20:07:27 +02:00
2025-05-21 23:12:47 +02:00
2025-05-22 21:23:16 +02:00
2025-05-22 20:46:34 +02:00
2025-02-10 12:46:54 +01:00
2025-05-21 22:24:26 +02:00
2025-05-05 14:49:20 +02:00

🐚 42sh A Unix Shell Inspired by TCSH

42sh is a custom Unix shell written in C as part of the EPITECH curriculum. Inspired by tcsh, this project aims to recreate a powerful, interactive command-line interface, complete with many built-in features, scripting capabilities, and user-friendly enhancements.

Features

  • Built-in commands:
    • cd, echo, exit, alias, setenv, unsetenv, env, printenv, which, where, repeat, yes, termname, expr, and more...
  • Redirections:
    • Input/output redirection support: >, <, >>, << (here-documents)
  • Pipelines:
    • Command chaining using pipes (|)
  • Globbing:
    • Wildcard expansion (*, ?, etc.)
  • Job control:
    • Background job handling with & fg bg Ctrl+Z
  • History:
    • Command history navigation using arrow keys
  • Interractive reverse search:
    • Search in the history with Ctrl+R
  • Line editing:
    • Interactive line editing and cursor movement
  • Auto completion:
    • Interactive auto completion with TAB
  • Git integration:
    • Dynamic prompt with branch name, ahead and behind indicator
  • Alias system:
    • Define and expand custom aliases
  • Environment variables:
    • Manage the shells environment
  • And more...

⚙️ Build & Run

git clone https://github.com/Savapitech/42sh.git
cd 42sh
make
./42sh
  • Requires a POSIX-compliant system and a C compiler (tested with gcc on Linux).

📁 Project Structure

42sh/
├── include/            # Header files
├── src/                # Shell source code
├── ulib/               # Custom utility libraries
├── validation_tests.py # Functional tests
├── Makefile            # Build system
└── README.md           # You're reading it!

🧠 Concepts & Architecture

  • Lexer/Parser: Tokenizes user input into an Abstract Syntax Tree (AST)
  • Executor: Traverses the AST to execute commands
  • Builtins: Custom implementation of standard shell commands

🧪 Testing

You can run the test suite using:

make tests_run

(Requires python3)

❄️ Nix Support

This project provides full support for Nix:

  • You can run the shell directly with:
nix run github:Savapitech/42sh
  • If you are working on the project, a development environment is available via the flake:
nix develop

This gives you access to a reproducible devShell with all required dependencies.

🛠️ Development Notes

Written in C99

Follows the EPITECH coding style

No memory leaks (only if no errors occured)

Handles signals (e.g., Ctrl+C, Ctrl+D)

Compatible with tcsh-style interactive behavior

📜 License

This project is part of the Epitech curriculum and is shared for educational purposes.

👥 Authors

@savalet, @tekClovis, @Arthur-gtr, @Titouanhct, @eiffis

CI

Description
No description provided
Readme 641 KiB
Languages
C 90.6%
Python 6%
Makefile 2.4%
Nix 0.7%
Shell 0.3%