Skip to content

4rjxn/seal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Seal 🦭

Seal is a lightweight, Unix-like shell written in Rust. It provides a familiar command-line interface with support for essential shell features, including built-in commands, external program execution, input/output redirection, and piping. Seal is my personal thing as result this may contain some explicit content.

Features

  • Built-in Commands:
    • cd [dir]: Change the current working directory. Supports ~ for the home directory.
    • echo [args]: Print arguments to the standard output.
    • pwd: Print the current working directory.
    • type [command]: Indicate how a command would be interpreted (builtin or external).
    • exit: Exit the shell.
  • External Command Execution: Seamlessly runs programs available in your $PATH.
  • Redirection:
    • > or 1>: Redirect standard output to a file (truncates).
    • 2>: Redirect standard error to a file (truncates).
    • >> or 1>>: Append standard output to a file.
    • 2>>: Append standard error to a file.
  • Pipelining: Support for basic command piping (cmd1 | cmd2).
  • Quote Handling: Supports single quotes ('), double quotes ("), and backslashes (\) for complex command arguments.
  • Line Editing: Powered by rustyline for a smooth terminal experience with history and line editing capabilities.

Getting Started

Prerequisites

  • Rust (2024 edition or later)

Installation

  1. direct installation (build from source).

    curl -fSSL https://raw.githubusercontent.com/4rjxn/seal/refs/heads/trunk/invoke.sh | sh
  2. Clone the repository:

    git clone https://github.com/4rjxn/seal.git
    cd seal
  3. Build the project:

    cargo build --release
  4. Run the shell:

    ./target/release/seal

Usage Examples

Basic Commands

>> pwd
/home/user/seal
>> echo Hello, Seal!
Hello, Seal!

Redirection

>> echo "Hello, World" > hello.txt
>> cat hello.txt
Hello, World
>> ls non_existent_file 2> error.log

Pipelines

>> ls | grep .rs
main.rs
parser.rs

Complex Arguments

>> echo "This is a \"quoted\" argument"
This is a "quoted" argument

Dependencies

  • rustyline: For command-line editing and history.
  • nix: For Unix system calls (fork, exec, signals).
  • is_executable: To verify executable permissions in $PATH.

License

This project is open-source and available under the GNU General Public License version 2.0 (GPL-2.0).

About

a rust based shell for linux based systems

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors