SCDocParser: filter out \r (carriage return) when reading file, also improved String...
[supercollider.git] / setMainVersion.sh
blob676df2af86691d169bd4e546510481ecd6206ba3
1 #!/bin/sh
3 mainfile="SCClassLibrary/DefaultLibrary/Main.sc"
5 # Double-check that there's exactly one in each!
6 count1=$( grep -c "classvar" VERSION )
7 count2=$( grep -c "classvar scVersion" $mainfile )
8 if [ $count1 != 1 ] || [ $count2 != 1 ]; then
9 echo "ERROR in setMainVersion.sh: we require exactly one 'classvar' line to be detected. Check ../VERSION and Main.sc."
10 exit
13 versionline=$( grep "classvar" VERSION )
14 line=$( grep "classvar scVersion" $mainfile )
16 echo $versionline
17 echo $line
19 # only update if they don't already match
20 if [ "$versionline" != "$line" ]; then
21 sed "s/$line/$versionline/" <$mainfile >tempfile
22 cp tempfile $mainfile
23 rm tempfile