gosh

A powerful command-line shell written in Go with sh-style scripting support

Works seamlessly on Windows, macOS, and Linux. Gosh, it's good to have a reliable shell everywhere!

gosh
$ ./gosh
gosh> ls -la
drwxr-xr-x 5 user staff 160 Dec 15 10:30 .
-rw-r--r-- 1 user staff 1024 Dec 15 10:29 README.md
gosh> dir -l
drwxr-xr-x 5 user staff 160 Dec 15 10:30 .
-rw-r--r-- 1 user staff 1024 Dec 15 10:29 README.md
gosh> echo "Cross-platform!"
Cross-platform!
gosh> ./script.sh
Hello from gosh script!
Script works on Windows too!
gosh> ./bash_script.sh
Running with bash interpreter!
Shebang support works!
gosh> ./bash_script.sh
Running with bash interpreter!
Shebang support works!
gosh> _
gosh
$ ./gosh
gosh> ls -la
drwxr-xr-x 5 user staff 160 Dec 15 10:30 .
-rw-r--r-- 1 user staff 1024 Dec 15 10:29 README.md
gosh> dir -l
drwxr-xr-x 5 user staff 160 Dec 15 10:30 .
-rw-r--r-- 1 user staff 1024 Dec 15 10:29 README.md
gosh> echo "Cross-platform!"
Cross-platform!
gosh> ./script.sh
Hello from gosh script!
Script works on Windows too!
gosh> _

Features

🚀

Multiple Execution Modes

Interactive mode, command mode, and script mode for maximum flexibility

🔗

Unix Pipes & Redirection

Full support for pipes, input/output redirection, and command chaining

📝

Shell Scripting

Write powerful shell scripts with functions, control structures (if/case), variable expansion, and command substitution. Works seamlessly on Windows with automatic script detection!

🪟

Windows Shell Script Support

Automatic detection and execution of .sh files and shebang scripts on Windows. No more "not a valid Win32 application" errors - gosh handles it all!

🔧

Shebang Support

On Unix-like platforms, scripts run with their specified interpreters (bash, zsh, etc.). Missing interpreters show errors, missing shebangs get a gosh pun warning!

Cross-Platform File Operations

Built-in commands that work on Windows, macOS, and Linux with both Unix (ls, cat, cp) and Windows (dir, type, copy) style commands

🌟

Modern Features

Command history, aliases, platform-aware tab completion (case-insensitive on Windows, case-sensitive on Unix), case-insensitive execution, and background execution. Gosh, that's smart!

🛡️

Signal Handling

Robust Ctrl-C handling that interrupts commands without exiting the shell

🌍

Cross-Platform Compatible

Works seamlessly on Windows, macOS, and Linux with consistent behavior across all platforms

Getting Started

1

Build gosh

go build -o gosh

Cross-platform builds:

GOOS=windows go build -o gosh.exe
GOOS=linux go build -o gosh-linux
GOOS=darwin go build -o gosh-macos
2

Run Interactive Mode

./gosh

Gosh, that was easy!

3

Try Command Mode

./gosh -c "ls -la"
./gosh -c "dir -l"

Both Unix and Windows style commands work!

4

Execute Scripts

./gosh script.sh
gosh script.sh arg1 arg2

By gosh, scripting has never been simpler!

Unix/Linux/macOS: Scripts with shebangs (#!/bin/bash, #!/usr/bin/env zsh) run with their specified interpreters. Missing shebangs get a gosh pun warning!

Windows users: Gosh automatically detects and runs .sh files and shebang scripts - no "not a valid Win32 application" errors. Gosh darn it, that's convenient!

Documentation