1
- cmd=` basename $0`
1
+ cmd=$( basename "$0")
2
2
3
3
usage()
4
4
{
@@ -24,7 +24,7 @@ usage()
24
24
echo " 1. With an OpenCoarrays-Aware (OCA) compiler (GNU 5.1.0 or later),"
25
25
echo " a. If any of the options listed above appear, any remaining arguments are ignored."
26
26
echo " b. If present, <fortran-source-file> must"
27
- echo " * be a Fortran source file,"
27
+ echo " * be a Fortran source file,"
28
28
echo " * appear before all other arguments,"
29
29
echo " * be the only Fortran source file in the argument list,"
30
30
echo " * have a name of the form *.f90, *.F90, *.f, or *.F. "
@@ -87,28 +87,28 @@ elif [[ $1 == '-h' || $1 == '--help' ]]; then
87
87
exit 1
88
88
elif [ "$caf_compiler" = "true" ]; then
89
89
# Nothing to do other than invoke the compiler with all the command-line arguments:
90
- $CAFC "$@" -L $caf_lib_dir $link_args
90
+ $CAFC "$@" -L " $caf_lib_dir" $link_args
91
91
else
92
92
# Verify that a file with the .f90, .F90, .f, or .F extension is the first argument:
93
- src_extension=` echo "$1" | cut -f2 -d'.'`
93
+ src_extension=$( echo "$1" | cut -f2 -d'.')
94
94
if [[ $src_extension == 'f90' || $src_extension == 'F90' || $src_extension == 'f' || $src_extension == 'F' ]]; then
95
95
# copy the source file into a new file for pre-processing (preprending "caf-" to the new file name):
96
- cp $1 caf-$1
96
+ cp "$1" " caf-$1"
97
97
# Edit the copied source to replace CAF syntax with calls to public procedures in opencoarrays.f90:
98
98
if [ "$linux" = "true" ]; then
99
- sed -i'' 's/sync all/call sync_all/g' caf-$1
100
- sed -i'' 's/error stop/call error_stop/g' caf-$1
101
- sed -i'' 's/sync images/call sync_images/g' caf-$1
99
+ sed -i'' 's/sync all/call sync_all/g' " caf-$1"
100
+ sed -i'' 's/error stop/call error_stop/g' " caf-$1"
101
+ sed -i'' 's/sync images/call sync_images/g' " caf-$1"
102
102
else
103
103
# This works on OS X and other POSIX-compliant operating systems:
104
- sed -i '' 's/sync all/call sync_all/g' caf-$1
105
- sed -i '' 's/error stop/call error_stop/g' caf-$1
106
- sed -i '' 's/sync images/call sync_images/g' caf-$1
104
+ sed -i '' 's/sync all/call sync_all/g' " caf-$1"
105
+ sed -i '' 's/error stop/call error_stop/g' " caf-$1"
106
+ sed -i '' 's/sync images/call sync_images/g' " caf-$1"
107
107
fi
108
108
# Replace the file name in command-line argment 1 with the new name beofre invoking the compiler:
109
- set -- "caf-$1" "${@:2:max_arguments}"
109
+ set -- "caf-$1" "${@:2:$ max_arguments}"
110
110
# Invoke the compiler along with all command-line arguments:
111
- $CAFC "$@" -L $caf_lib_dir -I $caf_mod_dir $link_args
111
+ $CAFC "$@" -L " $caf_lib_dir" -I " $caf_mod_dir" $link_args
112
112
else
113
113
# Print usage information upon encountering an unknowon CAF source file extension
114
114
usage | less
0 commit comments