1- cmd=` basename $0`
1+ cmd=$( basename "$0")
22
33usage()
44{
@@ -24,7 +24,7 @@ usage()
2424 echo " 1. With an OpenCoarrays-Aware (OCA) compiler (GNU 5.1.0 or later),"
2525 echo " a. If any of the options listed above appear, any remaining arguments are ignored."
2626 echo " b. If present, <fortran-source-file> must"
27- echo " * be a Fortran source file,"
27+ echo " * be a Fortran source file,"
2828 echo " * appear before all other arguments,"
2929 echo " * be the only Fortran source file in the argument list,"
3030 echo " * have a name of the form *.f90, *.F90, *.f, or *.F. "
@@ -87,28 +87,28 @@ elif [[ $1 == '-h' || $1 == '--help' ]]; then
8787 exit 1
8888elif [ "$caf_compiler" = "true" ]; then
8989 # 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
9191else
9292 # 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'.')
9494 if [[ $src_extension == 'f90' || $src_extension == 'F90' || $src_extension == 'f' || $src_extension == 'F' ]]; then
9595 # 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"
9797 # Edit the copied source to replace CAF syntax with calls to public procedures in opencoarrays.f90:
9898 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"
102102 else
103103 # 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"
107107 fi
108108 # 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}"
110110 # 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
112112 else
113113 # Print usage information upon encountering an unknowon CAF source file extension
114114 usage | less
0 commit comments