diff --git a/model_zoo/research/cv/FaceDetection/scripts/run_distribute_train.sh b/model_zoo/research/cv/FaceDetection/scripts/run_distribute_train.sh index 70f4c9a62b..a025cfbb2e 100644 --- a/model_zoo/research/cv/FaceDetection/scripts/run_distribute_train.sh +++ b/model_zoo/research/cv/FaceDetection/scripts/run_distribute_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo " or: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE]" -exit 1 + exit 1 fi get_real_path(){ @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceDetection/scripts/run_eval.sh b/model_zoo/research/cv/FaceDetection/scripts/run_eval.sh index 4626b887a0..c050db29a1 100644 --- a/model_zoo/research/cv/FaceDetection/scripts/run_eval.sh +++ b/model_zoo/research/cv/FaceDetection/scripts/run_eval.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_eval.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceDetection/scripts/run_export.sh b/model_zoo/research/cv/FaceDetection/scripts/run_export.sh index 6c5c965171..a69475a6a7 100644 --- a/model_zoo/research/cv/FaceDetection/scripts/run_export.sh +++ b/model_zoo/research/cv/FaceDetection/scripts/run_export.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceDetection/scripts/run_standalone_train.sh b/model_zoo/research/cv/FaceDetection/scripts/run_standalone_train.sh index f3255db541..da388e3f85 100644 --- a/model_zoo/research/cv/FaceDetection/scripts/run_standalone_train.sh +++ b/model_zoo/research/cv/FaceDetection/scripts/run_standalone_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo " or: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID]" -exit 1 + exit 1 fi get_real_path(){ @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_distribute_train.sh b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_distribute_train.sh index 7fb7358fe2..d745186306 100644 --- a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_distribute_train.sh +++ b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_distribute_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo " or: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE]" -exit 1 + exit 1 fi get_real_path(){ @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_eval.sh b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_eval.sh index 59378228b2..89417082ba 100644 --- a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_eval.sh +++ b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_eval.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_export.sh b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_export.sh index 6c5c965171..a69475a6a7 100644 --- a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_export.sh +++ b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_export.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_standalone_train.sh b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_standalone_train.sh index 5667e82932..682ea45109 100644 --- a/model_zoo/research/cv/FaceQualityAssessment/scripts/run_standalone_train.sh +++ b/model_zoo/research/cv/FaceQualityAssessment/scripts/run_standalone_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo " or: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID]" -exit 1 + exit 1 fi get_real_path(){ @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_distribute_train.sh b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_distribute_train.sh index 6069e89fd3..b20251e25b 100644 --- a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_distribute_train.sh +++ b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_distribute_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo " or: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE]" @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH @@ -85,4 +85,4 @@ do --pretrained=$PRETRAINED_BACKBONE > train.log 2>&1 & done -echo 'running' \ No newline at end of file +echo 'running' diff --git a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_eval.sh b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_eval.sh index 06de8527f7..c4f14e89b7 100644 --- a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_eval.sh +++ b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_eval.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_export.sh b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_export.sh index 6c5c965171..2f8a55d006 100644 --- a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_export.sh +++ b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_export.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-201 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ if [ $# != 3 ] then echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" -exit 1 + exit 1 fi get_real_path(){ @@ -31,7 +31,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_standalone_train.sh b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_standalone_train.sh index f0dfcf8cde..c8c4b45d54 100644 --- a/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_standalone_train.sh +++ b/model_zoo/research/cv/FaceRecognitionForTracking/scripts/run_standalone_train.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # ============================================================================ -if [ $# != 2 -a $# != 3 ] +if [ $# != 2 ] && [ $# != 3 ] then echo "Usage: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo " or: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID]" @@ -32,7 +32,7 @@ get_real_path(){ current_exec_path=$(pwd) echo ${current_exec_path} -dirname_path=$(dirname $(pwd)) +dirname_path=$(dirname "$(pwd)") echo ${dirname_path} export PYTHONPATH=${dirname_path}:$PYTHONPATH diff --git a/tests/runtest.sh b/tests/runtest.sh index 412ee8c431..24db8d87df 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Huawei Technologies Co., Ltd +# Copyright 2019-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ set -e -CURRPATH=$(cd $(dirname $0); pwd) +CURRPATH=$(cd "$(dirname $0)"; pwd) if [ $# -gt 0 ]; then if [ $1 == "python" ]; then diff --git a/tests/ut/python/cachetests/cachetest.sh b/tests/ut/python/cachetests/cachetest.sh index 8db7d12c40..5a6e7b9c45 100755 --- a/tests/ut/python/cachetests/cachetest.sh +++ b/tests/ut/python/cachetests/cachetest.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Huawei Technologies Co., Ltd +# Copyright 2019-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ # ============================================================================ # This script is the driver of the individual test scenarios -CURRPATH=$(cd $(dirname $0); pwd) +CURRPATH=$(cd "$(dirname $0)"; pwd) echo "----------------------------------------------" echo "Invalid syntax and cache_admin failure testing" diff --git a/tests/ut/python/cachetests/cachetest_lib.sh b/tests/ut/python/cachetests/cachetest_lib.sh index e9bfcfc775..25aa4b0005 100755 --- a/tests/ut/python/cachetests/cachetest_lib.sh +++ b/tests/ut/python/cachetests/cachetest_lib.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Huawei Technologies Co., Ltd +# Copyright 2019-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ # test scenarios for cache op testing. # Set any path variables here -CURRPATH=$(cd $(dirname $0); pwd) -TESTPATH=$(cd ${CURRPATH}/../dataset; pwd) -PROJECT_PATH=$(cd ${CURRPATH}/../../../..; pwd) +CURRPATH=$(cd "$(dirname $0)"; pwd) +TESTPATH=$(cd "${CURRPATH}/../dataset"; pwd) +PROJECT_PATH=$(cd "${CURRPATH}/../../../../"; pwd) if [ "x${BUILD_PATH}" == "x" ]; then BUILD_PATH=${PROJECT_PATH}/build @@ -64,7 +64,7 @@ MsgOk() ################################################################################# # Function: MsgFail # -# Description: Display intput msg with a red format for a failure # +# Description: Display input msg with a red format for a failure # ################################################################################# MsgFail() { @@ -154,11 +154,11 @@ CacheAdminCmd() fi result=$(${cmd} 2>&1) rc=$? - if [ ${expect_fail} -eq 0 -a ${rc} -ne 0 ]; then + if [ "${expect_fail}" -eq 0 ] && [ "${rc}" -ne 0 ]; then MsgFail "FAILED" MsgError "cache_admin command failure!" "${rc}" "${result}" return 1 - elif [ ${expect_fail} -eq 1 -a ${rc} -eq 0 ]; then + elif [ "${expect_fail}" -eq 1 ] && [ "${rc}" -eq 0 ]; then MsgFail "FAILED" MsgError "Expected failure but got success!" "${rc}" "${result}" return 1 diff --git a/tests/ut/python/runtest_opensrc.sh b/tests/ut/python/runtest_opensrc.sh index 852b8dd9a0..ec036a9494 100644 --- a/tests/ut/python/runtest_opensrc.sh +++ b/tests/ut/python/runtest_opensrc.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Huawei Technologies Co., Ltd +# Copyright 2019-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # limitations under the License. # ============================================================================ -CURRPATH=$(cd $(dirname $0); pwd) +CURRPATH=$(cd "$(dirname $0)"; pwd) PROJECT_PATH=${CURRPATH}/../.. if [ $BUILD_PATH ];then echo "BUILD_PATH = $BUILD_PATH"