v0.1.0
- build static binaries for linux, darwin and freebsd - create deb and rpm packages that register gosh in /etc/shells - publish releases to Gitea - add --version flag, set at build time via ldflags Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gosh eine einfache Shell, geschrieben in golang.
gosh - Go Shell
Built-in commands:
cd [dir] - Change directory (cd with no args goes to home)
pwd - Print working directory
echo [args] - Echo arguments
exit [code] - Exit shell with optional status code
quit [code] - Quit shell with optional status code
set VAR=val - Set environment variable
export VAR=val - Export environment variable
help - Show this help
Features:
- Argument parsing with quotes and escapes ('...' is literal,
"..." expands variables, \ escapes the next character)
- Ctrl+D to exit, Ctrl+C to cancel the current line or command
- Command history (up/down arrows), stored in
$XDG_STATE_HOME/gosh/history (default ~/.local/state/gosh/history,
override with $GOSH_HISTFILE); lines starting with a space are not saved
- Tab completion for commands and file paths
- Tilde expansion (~, ~/path) at the start of unquoted words
- Environment variable expansion ($VAR, ${VAR}, ${VAR:-default});
using an unset variable is an error, use ${VAR:-} for an empty default
Sicherheitshinweise
- Die History liegt in
$XDG_STATE_HOME/gosh/history(Standard:~/.local/state/gosh/history) und ist nur für den eigenen Benutzer lesbar (Verzeichnis0700, Datei0600). MitGOSH_HISTFILElässt sich ein anderer Pfad setzen, mitGOSH_HISTFILE=wird die History abgeschaltet. - Zeilen, die mit einem Leerzeichen beginnen, werden nicht in der History gespeichert – praktisch für Befehle mit Passwörtern oder Tokens.
- Innerhalb von
'...'wird nichts expandiert,\$ergibt ein wörtliches$. - Eine nicht gesetzte Variable bricht den Befehl ab (wie
set -u), damit z. B.rm -rf $DIR/outnie mit leerem$DIRausgeführt wird. Für einen Standardwert${VAR:-default}bzw.${VAR:-}verwenden. - Variablenwerte werden nicht in mehrere Wörter aufgeteilt.
- Steuerzeichen in Verzeichnisnamen werden im Prompt escaped angezeigt (z. B.
\x1b), Dateien mit Steuerzeichen im Namen werden nicht vervollständigt. - Ctrl+C beendet nur den laufenden Befehl bzw. verwirft die aktuelle Zeile, nicht die Shell.
gosh is not meant for production use, it is just a proof of concept.
building
go build ./
Release
Binaries sowie .deb- und .rpm-Pakete werden mit GoReleaser gebaut (Konfiguration: .goreleaser.yaml).
# lokal testen, ohne etwas zu veröffentlichen (Ergebnis in dist/)
goreleaser release --snapshot --clean
# Release auf Gitea veröffentlichen
export GITEA_TOKEN=...
git tag -a v0.1.0 -m "v0.1.0"
git push origin v0.1.0
goreleaser release --clean
Das Paket installiert /usr/bin/gosh und trägt die Shell in /etc/shells ein, sodass sie mit chsh -s /usr/bin/gosh gesetzt werden kann.