Home

Awesome

Shsh Releases

<p align="center"> <img src="docs/images/shsh-logo.png"> </p>

A shell scripts handler (shsh) for managing shell scripts, functions, standalone binaries, completion files, and more.

CI ShellCheck Build Status AUR Version AUR-git Version Master Update License

What it does

Shsh allows you to quickly install shell packages directly from github or other sites. Instead of looking for specific install instructions for each package and messing with your $PATH, shsh will create a central location for all packages and manage their executable, completions files, and man files for you. It is multi-threaded to speed up updating and setting up your packages.

Shsh is a POSIX-compatible script handler, as a former fork of basher but was made to works with even the most strict POSIX compliance shell like dash. The performance of shsh is enhanced by using dash and with our use of multi-threaded approach. The flexibility of shsh comes from hooks where you can run arbitrary scripts that persists across package updates.

Quick Start

Automatic Installation

Automatically bootstrap and install shsh (which would also modify your shell's init script)

curl -s https://raw.githubusercontent.com/soraxas/shsh/master/bootstrap/install.sh | sh

Pre-made Recipes

shsh can retrive pre-made recipes hosted in my repo. For example:

shsh install -r mamba
shsh install -r git-annex

Custom Recipes

Ranger: A powerful terminal file manger

shsh install ranger/ranger -v REMOVE_EXTENSION=true -v BINS=ranger.py -h pre='sed -i "1d;2i#!/usr/bin/python3 -O" ranger.py'

Installation

  1. Manual: Checkout shsh inside $XDG_DATA_HOME, e.g., at ~/.local/share/shsh

     # clone shsh and add shsh to $PATH variable
     $ git clone https://github.com/soraxas/shsh ~/.local/share/shsh
     $ export PATH="$HOME/.local/share/shsh/bin:$PATH"
     # Optional: link shsh's own completion files and man pages to cellar
     $ cd ~/.local/share/shsh && make self-linking
    

    Or with AUR (Arch): Install shsh or shsh-git pacakage in AUR, e.g.

     $ yay -S shsh
    
  2. Initialise shsh in your shell init file, e.g.

     # in ~/.bashrc, ~/.zshrc, etc.
     eval "$(shsh init SHELL)"
     # SHELL: sh, bash, zsh, fish
    

    Fish: Use the following commands instead:

     $ shsh init fish | source
    

Updating

Run the following command to and pull the latest changes in shsh (Manual method only):

$ shsh self-upgrade

Usage

Examples

Command summary

Configuration options

To change the behavior of shsh, you can set the following variables either globally or before each command:

Packages handling

Recipes for installing packages (in shshrc)

The following are a list of recipes that uses shsh plus some lightweight hooks to bootstrap installing script/binaries on a new system. I personally has the following contents in my ~/.config/shshrc file.

I had defined some handy functions in the shshrc file:

has_cmd() {
  command -v "$1" >/dev/null
}
is_hostname() {
  [ $(cat /etc/hostname) = "$1" ]
}
is_wsl() {
  cat /proc/version | grep -q '[Mm]icrosoft'
}

Examples

Credits