@@ -136,7 +136,7 @@ if [[ "$scriptFile" != *kts ]] && [[ -e ${scriptFile} ]] ; then
136136
137137 # # replace script file with md5 hash file copy of stdin
138138 scriptFile=$( dirname ${stdinCache} ) /stdin_${stdinMD5} .kts
139- mv ${stdinCache} $scriptFile
139+ mv ${stdinCache} ${ scriptFile}
140140fi
141141
142142
145145if [[ " $scriptFile " != * kts ]] && [[ ! -e ${scriptFile} ]]; then
146146 # # auto-prefix one-liners with kscript-support api
147147 if [[ $( echo " ${scriptFile} " | wc -l) -eq 1 ]]; then
148- scriptFile=$' //DEPS de.mpicbg.scicomp:kscript:1.1 \n import kscript.* \n ' $ scriptFile
148+ scriptFile=$' //DEPS de.mpicbg.scicomp:kscript:1.2 \n import kscript.text.* \n val lines = resolveArgFile(args) \n\n ' ${ scriptFile}
149149 fi
150150
151151 scriptHash=$( kscript_md5 <( echo " $scriptFile " ) )
152152
153153 # http://unix.stackexchange.com/questions/174817/finding-the-correct-tmp-dir-on-multiple-platforms
154154 cachedScript=${KSCRIPT_CACHE_DIR} /scriptarg_cache_${scriptHash} .kts
155155
156- echo " $scriptFile " > $cachedScript
156+ echo " $scriptFile " > ${ cachedScript}
157157
158158 scriptFile=${cachedScript}
159159fi
160160
161161
162162# # just proceed if the script file is a regular file at this point
163163# echo "scriptfile is $scriptFile and interactive $is_interactive"
164- if [[ ! -f $scriptFile ]]; then
164+ if [[ ! -f ${ scriptFile} ]]; then
165165 echo " [ERROR] Could not open script file '$scriptFile '" 1>&2
166166 exit 1
167167fi
@@ -181,7 +181,7 @@ dependencies=$(grep "^//DEPS" ${scriptFile} | cut -f2- -d' ' | trim | tr ',;\n'
181181# fix me more consistent use of ${TMPDIR}
182182dependency_cache=" ${KSCRIPT_CACHE_DIR} /dependency_cache.txt"
183183if [ -n " $dependencies " ] && [ -f " $dependency_cache " ]; then
184- classpath=$( grep -F $( echo ${dependencies} | tr ' ' ' ;' ) " " $dependency_cache | cut -d' ' -f2)
184+ classpath=$( grep -F $( echo ${dependencies} | tr ' ' ' ;' ) " " ${ dependency_cache} | cut -d' ' -f2)
185185fi
186186
187187# # If there are dependencies but cache-lookup failed we run expandcp.kts
@@ -242,7 +242,7 @@ if [ ! -f "${jarFile}" ]; then
242242 echo '
243243 public class Main_' ${className} ' {
244244 public static void main(String... args) throws Exception {
245- Class script = Main_' ${className} ' .class.getClassLoader().loadClass("' $className ' ");
245+ Class script = Main_' ${className} ' .class.getClassLoader().loadClass("' ${ className} ' ");
246246 script.getDeclaredConstructor(String[].class).newInstance((Object)args);
247247 }
248248 }
0 commit comments