github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/_utils/check_usage_tips (about) 1 #!/bin/bash 2 # parameter 1: stdout file 3 # parameter 2: should_contain true: cmd is valid and usage tips should be printed, false: otherwise 4 stdout_file=$1 5 should_contain=$2 6 contain= 7 set +e 8 9 ## check stdout 10 if [ ! -f "$stdout_file" ]; then 11 echo "stdout log file does not exist" 12 exit 0 13 fi 14 15 grep -q 'Usage:' "$stdout_file" 16 if [[ $? -eq 0 ]]; then 17 contain="false" 18 else 19 contain="true" 20 fi 21 22 if [[ "$contain" == "$should_contain" ]]; then 23 exit 0 24 else 25 echo "Check Usage Tips Failed!" 26 exit 1 27 fi