File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22set -e
33
4- clientPath=${1%/ }
5- projectPath=${2%/ }
6- scanPath=$3
7- outFileName=$4
8- sqlParamName=$5
9-
10- # All parameters are required.
4+ # All parameters are required. This way, users can't pass empty string as parameter.
115invalidArgs=0
12- [ -z " $clientPath " ] && invalidArgs=1
13- [ -z " $projectPath " ] && invalidArgs=1
14- [ -z " $scanPath " ] && invalidArgs=1
15- [ -z " $outFileName " ] && invalidArgs=1
16- [ -z " $sqlParamName " ] && invalidArgs=1
6+ [ -z " $1 " ] && invalidArgs=1
7+ [ -z " $2 " ] && invalidArgs=1
8+ [ -z " $3 " ] && invalidArgs=1
9+ [ -z " $4 " ] && invalidArgs=1
10+ [ -z " $5 " ] && invalidArgs=1
1711
1812if [ $invalidArgs -eq 1 ]; then
1913 echo Usage: ut_run.sh " client_path" " project_path" " scan_path" " out_file_name" " sql_param_name"
2014 exit 1
2115fi
2216
17+ clientPath=${1%/ }
18+ projectPath=${2%/ }
19+ scanPath=$3
20+ outFileName=$4
21+ sqlParamName=$5
22+
2323fullOutPath=" $clientPath /$outFileName "
2424fullScanPath=" $projectPath /$scanPath "
2525
Original file line number Diff line number Diff line change 11@ echo off
22setlocal EnableDelayedExpansion
33
4- set clientPath = %~1
5- set projectPath = %~2
6- set scanPath = %~3
7- set outFileName = %~4
8- set sqlParamName = %~5
9-
10- REM All parameters are required.
4+ REM All parameters are required. This way, users can't pass empty string as parameter.
115set invalidArgs = 0
12- if " %clientPath% " == " " set invalidArgs = 1
13- if " %projectPath% " == " " set invalidArgs = 1
14- if " %scanPath% " == " " set invalidArgs = 1
15- if " %outFileName% " == " " set invalidArgs = 1
16- if " %sqlParamName% " == " " set invalidArgs = 1
6+ if " %1 " == " " set invalidArgs = 1
7+ if " %2 " == " " set invalidArgs = 1
8+ if " %3 " == " " set invalidArgs = 1
9+ if " %4 " == " " set invalidArgs = 1
10+ if " %5 " == " " set invalidArgs = 1
1711
1812if %invalidArgs% == 1 (
1913 echo Usage: ut_run.bat " client_path" " project_path" " scan_path" " out_file_name" " sql_param_name"
2014 exit /b 1
2115)
2216
17+ set clientPath = %~1
18+ set projectPath = %~2
19+ set scanPath = %~3
20+ set outFileName = %~4
21+ set sqlParamName = %~5
22+
2323REM Remove trailing slashes.
2424if %clientPath:~-1 % == \ set clientPath = %clientPath:~0 ,-1 %
2525if %projectPath:~-1 % == \ set projectPath = %projectPath:~0 ,-1 %
Original file line number Diff line number Diff line change 11#! /bin/bash
22set -e
33
4- # Not forget to convert line endings to Unix.
5- # http://linuxcommand.org/man_pages/dos2unix1.html
6- # sed -i 's/\r//' ut_run
7- # sed -i 's/\r//' file_list
8-
94clientDir=" $( dirname " $( readlink -f " $0 " ) " ) "
105projectDir=" $( pwd) "
116
12- if [ " $clientDir " != " ${clientDir% * } " ]; then
7+ if [[ " $clientDir " != " ${clientDir% * } " ] ]; then
138 echo " Error: ut_run script path cannot have spaces."
149 exit 1
1510fi
You can’t perform that action at this time.
0 commit comments