Skip to content

Commit 2363403

Browse files
committed
Address shellcheck issues in check_version.sh
1 parent 2895530 commit 2363403

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

prerequisites/check_version.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
# POSSIBILITY OF SUCH DAMAGE.
3434

3535
# Interpret the first argument as the package executable name
36-
package=$1
36+
package="$1"
3737
# Interpret the second argument as the minimimum acceptable package version number
38-
minimum_version=$2
38+
minimum_version="$2"
3939
# Interpret the third argument as indicating the desired verbosity
4040
verbose=$3
4141

42-
this_script=`basename $0`
42+
this_script=$(basename "$0")
4343

4444
usage()
4545
{
@@ -58,31 +58,31 @@ usage()
5858
echo ""
5959
echo " $this_script cmake 3.4.0"
6060
echo " $this_script flex 2.6.0 --verbose"
61-
echo " $this_script flex `./build flex --default --query-version`"
61+
echo " $this_script flex $(./build.sh -V flex )"
6262
echo " $this_script --help"
6363
echo " $this_script --list"
6464
echo ""
6565
echo "[exit 10]"
6666
exit 10
67-
}
67+
}
6868

6969
# Print usage information and exit if script is invoked without arguments or with --help or -h as the first argument
7070
if [ $# == 0 ]; then
7171
usage | less
72-
exit 20
72+
exit 20
7373

7474
elif [[ $1 == '--help' || $1 == '-h' ]]; then
7575
usage | less
76-
exit 30
76+
exit 30
7777

7878
elif [[ $1 == '--list' || $1 == '-l' ]]; then
7979
echo "$this_script currently verifies minimum version numbers for the following OpenCoarrays prerequisites:"
8080
echo " cmake, flex, bison, m4"
81-
exit 40
81+
exit 40
8282

8383
elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
8484
# Print script copyright if invoked with -v, -V, or --version argument
85-
cmake_project_line=`grep project ../CMakeLists.txt | grep VERSION`
85+
cmake_project_line=$(grep project ../CMakeLists.txt | grep VERSION)
8686
text_after_version_keyword="${cmake_project_line##*VERSION}"
8787
text_before_language_keyword="${text_after_version_keyword%%LANGUAGES*}"
8888
opencoarrays_version=$text_before_language_keyword
@@ -99,9 +99,9 @@ elif [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
9999
echo ""
100100
fi
101101

102-
package_version_header=`$1 --version | head -1`
102+
package_version_header=$($package --version | head -1)
103103
if [[ "$verbose" == "--verbose" ]]; then
104-
echo $package_version_header
104+
echo "$package_version_header"
105105
fi
106106

107107
# Extract the text after the final space:

0 commit comments

Comments
 (0)