From: 이상규/동작제어Lab(SR)/Principal Engineer/삼성전자 Date: Thu, 18 Oct 2018 06:33:59 +0000 (+0900) Subject: Suppress `which`'s output from format-checker.sh (#3232) X-Git-Tag: 0.3~587 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a00b3f519fe32638838d3910df40e3721c4e0344;p=platform%2Fcore%2Fml%2Fnnfw.git Suppress `which`'s output from format-checker.sh (#3232) - Suppress output from `which` command - Replace `which` to `command -v` for support builtin command also - Remove function keywords for better portability Signed-off-by: Sanggyu Lee --- diff --git a/scripts/command/format-checker.sh b/scripts/command/format-checker.sh index 7c2b477..002dab3 100755 --- a/scripts/command/format-checker.sh +++ b/scripts/command/format-checker.sh @@ -1,25 +1,27 @@ #!/bin/bash -function pushd () { +pushd () { command pushd "$@" > /dev/null } -function popd () { +popd () { command popd "$@" > /dev/null } -function check_cpp_tool() { - which clang-format-3.9 - if [[ $? -ne 0 ]]; then +command_exists() { + command -v $1 > /dev/null 2>&1 +} + +check_cpp_tool() { + if ! command_exists clang-format-3.9; then echo "Error: clang-format-3.9 is not available." echo " Please install clang-format-3.9." exit 1 fi } -function check_python_tool() { - which yapf - if [[ $? -ne 0 ]]; then +check_python_tool() { + if ! command_exists yapf; then echo "Error: yapf is not available." echo " Please install yapf." exit 1 @@ -35,7 +37,7 @@ function check_newline_cr() { fi } -function check_cpp_files() { +check_cpp_files() { DIRECTORIES_TO_BE_TESTED=$1 DIRECTORIES_NOT_TO_BE_TESTED=$2 @@ -58,7 +60,7 @@ function check_cpp_files() { done } -function check_python_files() { +check_python_files() { DIRECTORIES_TO_BE_TESTED=$1 DIRECTORIES_NOT_TO_BE_TESTED=$2