- Shell 55.8%
- Go 44.2%
|
|
||
|---|---|---|
| .gitea/workflows | ||
| .vscode | ||
| .gitignore | ||
| build.sh | ||
| clean.sh | ||
| ensure-go.sh | ||
| go.mod | ||
| main.go | ||
| publish.sh | ||
| README.md | ||
| test.sh | ||
bb64
Installation
If you don't already have getpkg installed:
curl https://getbin.xyz/getpkg-install | bash
Then install bb64 via getpkg for the current user:
getpkg install bb64
Use
Bash Base64, written in Go (a port of the original C++ implementation).
Uses a custom Base64 character set for bash compatibility, not compatible with other utilities.
Usage:
bb64 BASE64COMMAND Decodes and runs the command
bb64 -[i|d] BASE64COMMAND Displays the decoded command
bb64 -e COMMAND Encodes the command and prints the result
bb64 -e Encodes the command provided on stdin and prints the result
bb64 -u Updates bb64 to the latest version (downloads from getbin.xyz)
bb64 -v Prints the version number
bb64 version Prints the version number
Implementation Notes
bb64 runs the command by replacing the current process, so it ensures that tty, environment variables etc are all identical for the run command. It works with interactive commands, like nano or ssh.
bb64 supports bash scripts, as the command is run as:
bash -c 'COMMAND'
Where COMMAND is passed to bash as a single argument.
Encoding (-e) preserves line breaks, so multi-line scripts — including # comments and
heredocs — survive the round trip. Runs of spaces/tabs collapse to a single space, other
control characters are stripped, and leading/trailing whitespace is trimmed.
Decoding for execution validates the entire payload: corrupted or truncated base64 is
refused (exit 255) rather than silently running a partial command. Whitespace inside the
encoded string is tolerated. The display modes (-i/-d) still show whatever prefix
decodes, with a warning if the payload is invalid.
If the command is run, the return value is the return value of the command. If it isn't run, bb64 returns -1 (exit code 255).
bb64 -u downloads the published binary for the current platform straight from
getbin.xyz (bb64:latest-<arch>) and atomically swaps it in place — no docker required.