Gosh is a lightweight, POSIX-compliant command-line shell implementation written in Go. It mimics the behavior of standard shells like Bash or Zsh, supporting built-in commands, external process execution, robust argument parsing, and I/O redirection.
gosh.mp4
Gosh supports core shell built-ins natively:
cd: Change the current working directory (supports~and absolute/relative paths).pwd: Print the current working directory.echo: Print text to standard output.type: Identify if a command is a builtin or an external executable (and where it is located).exit: Exit the shell with status code 0.
- Executes any binary found in the system
$PATH. - Supports execution of local binaries (e.g.,
./script.sh). - Smart path resolution that handles absolute, relative, and environment-based paths.
- Single Quotes (
'): Preserves literal values (e.g.,'file with spaces'). - Double Quotes (
"): Handles strings with spaces while allowing for escaped characters. - Complex Arguments: Correctly handles nested quotes and escaped spaces (e.g.,
"exe with \'single quotes\'").
Supports standard file redirection operators:
>: Redirect standard output (overwrite).>>: Redirect standard output (append).<: Redirect standard input.2>: Redirect standard error (overwrite).2>>: Redirect standard error (append).
Chaining commands together (e.g., cat file.txt | grep "search").
Tab-completion for commands and file paths.
- Arrow key navigation (Up/Down) to cycle through previous commands.
- Saving command history to a file between sessions.
- Go (1.18 or higher)
- Clone the repository:
git clone [repository](https://github.com/denisha-madhura/Gosh.git)
cd goshBuild the Shell:
go build -o GoshRun:
./Goshor Run the following command:
curl -fsSL https://denishamadhura.vercel.app/install.sh | bashgosh