Sometimes I just want to use bash, sometimes I need to store variables, paths, etc., so sometimes I use Bash Builder.
- set_config_var: Save per project persistent variables.
- get_config_var: Read per project persistent variables.
- configure_var: Prompt the user to input a variable.
- configure_path: Prompt the user to input a file path.
- setup_repo: Prompt the user to configure a git repository that the project is dependent on.
- Not much else...
- Create a new shell script to do something (e.g. configure a project).
- Use functions provided by bash-builder in your script. You might create a
setup.shscript to configure some variables, paths, repos, etc.
# Write a variable
set_conf_var "my-first-var" "A value"
# Read a stored variable
MY_VAR="$(get_conf_var "my-first-var")"
# Prompt user for a variable (if not set).
configure_var "my-variable" "The default value for my-variable"
# Prompt user to configure the path to a repo.
setup_repo "repo-path-var" "https://github.com/mbatc/Adder" "branch-to-clone"
echo "Bash builder cloned 'https://github.com/mbatc/Adder' to '$(get_conf_var "repo-path-var")'"- Run the
setup.shscript in a project directory using bash-builder
bash-builder /path/to/project /path/to/project/setup.sh- (optional) You could also reuse
setup.shwith a different project.
bash-builder /path/to/my-other-project /path/to/project/setup.shOpen a terminal, copy the command below, and run it.
mkdir -p ~/.local/bin | curl https://raw.githubusercontent.com/mbatc/bash-builder/main/bash-builder>~/.local/bin/bash-builder | chmod u+x ~/.local/bin/bash-builderRun bash-builder in your terminal to check it was successful.
The command downloads the bash-builder script to your ~/.local/bin folder and makes it executable.