Using the BANDIT

Using a specific copy of the BANDIT

In a phySystem, BANDIT is ready to use without any modification and there is no need to activate a new environment in order to use the default BANDIT copy. However, when a new copy of BANDIT is installed, either in a phySystem or in a supported GNU/Linux distribution, it is necessary to select first this new copy in order to activate the corresponding environment.

Checking the active copy of BANDIT

To check which copy of BANDIT is active, just issue:

$ bandit
bandit 1.9.0 - The Build AND Install Toolkit

BANDIT_HOME = /opt/bandit
BANDIT_RELEASE_TAG = latest
BANDIT_DOWNLOADS = /tmp/bandit

The version installed and the BANDIT_HOME variable are shown, as well as other useful information about the active copy of BANDIT.

You can also check the BANDIT_HOME environment variable to determine which copy of BANDIT is active and from which directory:

$ echo $BANDIT_HOME
/opt/bandit

Selecting the copy of BANDIT

Change to the home directory of the new copy of BANDIT you wan to use. Then, from that directory, source the BANDIT environment:

# cd /opt/<my-new-copy-of-bandit>
# source bandit.env

This copy of BANDIT is now the working toolkit in the system.

Hint

In a phySystem, to revert back to the main copy of BANDIT for that HOST, repeat the steps above on the original BANDIT directory, usually /opt/bandit.

Setting the default working copy of BANDIT at boot time

If the HOST system is a phySystem with a previous version of BANDIT installed, after rebooting the system the previous version of BANDIT will be active again. This also applies to terminal sessions; when a new copy is selected in one terminal, if a second terminal is open, the default BANDIT will be active, not that selected in the first terminal.

To make the new version of BANDIT the default one after boot, create and edit the file /etc/profile.d/bandit.sh and set the BANDIT_HOME and PATH variables accordingly:

export BANDIT_HOME=/opt/<my-new-copy-of-bandit>
export PATH=$PATH:/opt/<my-new-copy-of-bandit>/bin

First steps using BANDIT

Getting help on using BANDIT

To get more help about all the bandit commands and options, issue:

$ bandit --help

See also The BANDIT Reference for more details on getting help from the command line.

Autocompletion of BANDIT commands

BANDIT has autocompletion capabilities to hint and complete the BANDIT commands and options while writing in the command line. When a partial command is being typed just press the TAB key to complete the word or get a list of possible options.

For example, type bandit and press TAB to get the possible following options:

$ bandit<TAB>

yields:

$ bandit
-       --      edit    help    search

Type now sea and press the TAB key:

$ bandit sea<TAB>

to get the search word autocompleted:

$ bandit search

Now, press TAB again to get the options for the bandit search commands:

$ bandit search<TAB>
all   -b   -c   -f   -i   -l   --no-pager   --pager   -r   -x