bash来测试命令是否可以运行

时间:2016-11-26 14:15:40

标签: bash makefile

我有以下foreach ($_POST['books'] as $isbn => $on){ // do something with $isbn }

makefile

如何更改它,以便在缺少依赖性时显示更合适的错误并继续检查?

我试过了:

SHELL += -eu
GREEN=$(shell echo -e "\033[0;32m")
RED=$(shell echo -e "\033[0;31m")

AWS=$(shell command aws --version 2> /dev/null)
all: prereqs
    @echo "${GREEN} ✓ Testing our local environment for dependencies."

prereqs:
    ifndef "${AWS}"
        $(error "${RED} AWS is not available please install aws-cli")
    endif
        "${AWS}"

但它似乎没有用,我遗漏的是prereqs: aws --version || $(error "${RED} AWS is not available please install aws-cli") @echo 存在!

非常感谢任何建议。

1 个答案:

答案 0 :(得分:1)

您遗漏了关于.option("url", "jdbc:redshift://example.coyf2i236wts.eu-central- 1.redshift.amazonaws.com:5439/agcdb?user=user&password=pwd?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory")如何运作的几点知识: -

改为写下:

make

并注意差异。

我也认为会有改进:

SHELL += -eu
GREEN=$(shell echo -e "\033[0;32m")
RED=$(shell echo -e "\033[0;31m")

AWS:=$(shell command aws --version 2> /dev/null)
all: prereqs
    @echo "${GREEN} ✓ Testing our local environment for dependencies."

prereqs:
ifndef AWS
$(error "${RED} AWS is not available please install aws-cli")
endif
    @echo "${AWS}"

不要将用户留在彩色外壳中。

相关问题