Last active
March 2, 2019 03:04
-
-
Save simonrad/f1c852a4bd463dd6e8fbc8282265c8de to your computer and use it in GitHub Desktop.
Just some example bash code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| cd `dirname "$0"` # cd to the directory containing this script. | |
| cd `git rev-parse --show-toplevel` # cd to the root of the git repo. | |
| set -e # Fail on errors. | |
| set -x # Print commands. | |
| # Some example code below: | |
| # ------------------------ | |
| DESIRED_MOCKERY_VERSION="1.0.0" | |
| # Assert that mockery is installed. | |
| if ! [ -x "$(command -v mockery)" ]; then | |
| echo "Error: mockery is not installed. Please install mockery $DESIRED_MOCKERY_VERSION" >&2 | |
| exit 1 | |
| fi | |
| # Assert that the correct version of mockery is installed. | |
| if ! [ "$(mockery -version)" == $DESIRED_MOCKERY_VERSION ]; then | |
| echo "Error: The wrong version of mockery is installed. You have version $(mockery -version); version $DESIRED_MOCKERY_VERSION expected." >&2 | |
| exit 1 | |
| fi | |
| # Loop. | |
| SOME_VALUES=("val1" "val2" "val3" "val4") | |
| for V in "${SOME_VALUES[@]}"; do | |
| echo "$V" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment