-
Notifications
You must be signed in to change notification settings - Fork 16
Useful Scripts
mikekab edited this page Jan 14, 2013
·
1 revision
Example Bash Script
The following short bash script is useful in testing for successful translation of files in your workspace.
- Set the MAINDIR variable to your workspace Main directory.
- Set the COMPILER variable to the version of your compiled Resolve compiler that has the dependencies bundled in.
- Save the file in some directory above the workspace files you wish to translate.
- Grant it executable permission with chmod +x .
Usage:
./translate.sh <regex>
For example,
./translate.sh *.fa
#! /bin/sh -
MAINDIR=~/resolve/workspace/RESOLVE/Main/
COMPILER=~/resolve/myfork/RESOLVE/target/RESOLVE-12.09.01a-jar-with-dependencies.jar
for fname in `find -name $1`
do
basefilename_nosuffix=`basename ${fname%.*}`
basefilename=`basename $fname`
#echo java -jar $COMPILER -maindir $MAINDIR -translate $fname
printf "\ncompiling %s\n" $basefilename
java 2>&1 -jar $COMPILER -maindir $MAINDIR -translate $fname | grep Complete.*$basefilename_nosuffix
# tests exit code of grep (if phrase not found the compiliation was not successful)
if test $? -gt 0
then
printf "%s did not compile\n" $basefilename
fi
done
Sample output:
$ ./translate.sh *.rbcompiling Std_Print_Realiz.rb
Std_Print_Realiz.rb did not compilecompiling Std_Location_Linking_Realiz.rb
Std_Location_Linking_Realiz.rb did not compilecompiling Example_Realiz.rb
Complete record: Integer_Template.Example_Realiz
This version suppresses errors. It is intended to report only success or failure.