; Date: Thu Jul 25 2019
Tags: Shell Scripts
Installing Basher is very simple:
$ git clone https://github.com/basherpm/basher.git ~/.basher
This downloads a ready-to-use repository that contains the Basher script all ready to go.
$ ~/.basher/bin/basher Usage: basher <command> for a command commands List all available basher commands init Configure the shell environment for basher See 'basher help <command>' for information on a specific command.Some useful basher commands are: help Display help
To make the
basher program directly executable using that command name, the
~/.basher/bin directory of course must be in the PATH variable. This is suggested in the Basher README:
$ echo 'export PATH="$HOME/.basher/bin:$PATH"' >> ~/.bash_profile
However I prefer to instead have
$HOME/bin as a directory in my PATH, and to install scripts in that directory. Instead of the above, I did this:
$ ln -s ~/.basher/bin/basher ~/bin/basher
basher init command contains shell variable settings that could instantiate Basher:
$ ~/.basher/bin/basher init export BASHER_SHELL=bash export BASHER_ROOT=/Users/david/.basher export BASHER_PREFIX=/Users/david/.basher/cellar export BASHER_PACKAGES_PATH=/Users/david/.basher/cellar/packages export PATH="$BASHER_ROOT/cellar/bin:$PATH" . "$BASHER_ROOT/lib/include.bash" . "$BASHER_ROOT/completions/basher.bash" for f in $(command ls "$BASHER_ROOT/cellar/completions/bash"); do source "$BASHER_ROOT/cellar/completions/bash/$f"; done
And one way to set that up is:
$ ~/.basher/bin/basher help init Usage: eval "$(basher init -)" Configure the shell environment for basher
In other words, adding
eval "$(basher init -)" to your
.bashrc will initialize Basher.
In fact that's one of the recommendations in the Basher README, namely:
$ echo 'eval "$(basher init -)"' >> ~/.bash_profile
Except - for that to work correctly, the
basher script must be in the PATH using one of the methods shown earlier.
Okay, then what? Next step after installing Basher?
Unfortunately there is no registry of Basher-compatible packages.
The Basher README lists a couple
- https://github.com/sstephenson/bats - is a unit test system for Bash scripts
- https://github.com/juanibiapina/gg - I didn't look this up to see what it is
The reason I found Basher was from learning about
NAVE, an alternative to
nvm for managing Node.js runtimes.
The instructions to install a package are basically:
$ basher install isaacs/nave
By default Basher installs packages hosted on Github, using this syntax. Packages hosted in other locations can be installed using a different syntax.
But you're on your own finding packages that are installable using Basher.
$ basher help update Usage: basher update Updates basher to the latest version
Upgrading a package
$ basher help upgrade Usage: basher upgrade <package> Upgrades a package