Last active
March 13, 2020 06:50
-
-
Save icy/99ba9659b307c8e8ed3750dde1a1c971 to your computer and use it in GitHub Desktop.
Makefile-vs-Bash.sh
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
## Makefile | |
.PHONY: default | |
default: | |
@echo This is default | |
.PHONY: tests | |
tests: | |
@echo We have tests. All tests passed. | |
.PHONY: failing | |
failing: | |
@echo We have tests. All tests failed. | |
.PHONY: ifthen | |
ifthen: | |
@if foo; then \ | |
echo "This is foo"; \ | |
else \ | |
echo "This is bar" ; \ | |
fi | |
.PHONY: all | |
all: tests ifthen failing | |
@echo We have all. All failed. | |
## Bash file | |
#!/usr/bin/env bash | |
default() { echo "This is default"; } | |
tests() { echo "We have tests. All tests passed."; } | |
failing() { echo "We have tests. All tests failed."; } | |
ifthen() { if foo; then echo "This is foo"; else echo "This is bar"; fi; } | |
all() { tests && ifthen && failing && echo "We have tests. all tests failed"; } | |
unknown_command() { echo "Unknown command"; } | |
"${@:-unknown_command}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment