Skip to content

🐧 Run Command against multiple versions of BASH (requires Docker)

License

Notifications You must be signed in to change notification settings

shellbox-sh/multibash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐧 $ multibash

Verify your shell scripts work across multiple versions of BASH!


⬇️ Install

Download the latest version or run:

curl -o- https://multibash.shellbox.sh/install.sh | bash

πŸƒπŸΏβ€β™€οΈ Run

./multibash 3.2.57 bash --version

BASH image not installed locally for version: 3.2.57

Pulling image from Docker Hub...
3.2.57: Pulling from library/bash
Digest: sha256:81d765725efc7ef7994a8ec7363441...
Status: Downloaded newer image for bash:3.2.57
docker.io/library/bash:3.2.57

GNU bash, version 3.2.57(1)-release (x86_64-pc-linux-musl)
Copyright (C) 2007 Free Software Foundation, Inc.

The Docker image will only download if it is not already downloaded:

./multibash 5.0,3.2.57 bash --version

5.0
GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-musl)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu...

This is free software; you are free to change and r...
There is NO WARRANTY, to the extent permitted by law.

3.2.57
GNU bash, version 3.2.57(1)-release (x86_64-pc-linux-musl)
Copyright (C) 2007 Free Software Foundation, Inc.

Run multibash without any commands to start an interactive Bash shell:

./multibash 4.4

4.4
bash-4.4# echo "Hello, world"
Hello, world
bash-4.4#

🚒 Docker

multibash runs using Docker and the official bash image.

You can find instructions for installing Docker at:

You can find all of the versions of Bash supported by multibash at:

Tip: Test with 3.2.57 to help verify your script's Mac OS support

πŸ“– Documentation

./multibash --help

Usage: ./multibash [BASH version],[BASH version] [command (optional)] [arguments]

If command is provided, it will be run in a Docker container of the specified BASH version(s).
If command is not provided, it will start an interactive BASH session. Use 'exit' to exit.

# BASH Docker Images

  If the provided BASH versions are not locally installed as Docker container images,
  the container images will be automatically downloaded and installed.
  
  To view all locally installed BASH docker images, run:
  
    docker images | grep ^bash
  
  To remove a locally installed BASH Docker container image for a specific BASH version, run:
  
    docker image rm bash:4.4

# BASH Versions Available

  For a list of available BASH versions, see the bash Docker image on Docker Hub:
  https://hub.docker.com/_/bash

# Configuration

  When the Docker container is run the current directory is mounted inside the container as /app.
  When a command is run, it is executed from the mounted folder, so it is run from inside /app.
  
  Set MULTIBASH_DIR="path/to/folder" to mount a directory other than the current directory.
  Set MULTIBASH_MOUNT=/path to mount the directory as a specific location in the container.
  Set MULTIBASH_WORKDIR="path/to/folder" to run commands from this location *inside* the container.

Visit https://multibash.shellbox.sh for official project documentation.