#!/bin/bash FOLDER='planet_EMC1.1.0' ARCHIVE='planet_EMC1.1.0.tgz' LOCAL=$('pwd') isknown() { zb='0B' read command whereis $command > ./tmp du -sh ./tmp > ./tmp2 while read line do str=$line done < "./tmp2" if echo "$str" | grep -q "$zb" ; then echo false else echo true fi } minimum_version=2 # Since Chet Ramey is constantly adding features to Bash, # you may set $minimum_version to 2.XX, 3.XX, or whatever is appropriate. E_BAD_VERSION=80 if [ "$BASH_VERSION" \< "$minimum_version" ] then echo "This script works only with Bash, version $minimum or greater." echo "Upgrade strongly recommended." exit $E_BAD_VERSION fi i_f77=$( isknown < /dev/null echo "...done" echo "The archive was extracted in: ./"$FOLDER cd $FOLDER/data echo "" echo "+ Compiling program make_cloud_data.exe" if [[ $i_f77 == "true" ]] then ./f0_f77 elif [[ $i_g77 == "true" ]] then ./f0_g77 elif [[ $i_pgf77 == "true" ]] then ./f0_pgf77 elif [[ $i_pgf90 == "true" ]] then ./f0_pgf90 elif [[ $i_f95 == "true" ]] then ./f0_f95 elif [[ $i_ifort == "true" ]] then ./f0_ifort fi if [ ! -f make_cloud_data.exe ] then echo 'Error: make_cloud_data.exe could not be compiled' else echo "" echo "+ Running program make_cloud_data.exe" ./make_cloud_data.exe fi echo "" echo "+ Compiling program make_grid.exe" if [[ $i_f77 == "true" ]] then ./f1_f77 elif [[ $i_g77 == "true" ]] then ./f1_g77 elif [[ $i_pgf77 == "true" ]] then ./f1_pgf77 elif [[ $i_pgf90 == "true" ]] then ./f1_pgf90 elif [[ $i_f95 == "true" ]] then ./f1_f95 elif [[ $i_ifort == "true" ]] then ./f1_ifort fi if [ ! -f make_grid.exe ] then echo 'Error: make_grid.exe could not be compiled' else echo "" echo "+ Running program make_grid.exe" ./make_grid.exe fi echo "" echo "+ linking files" cd .. cd $LOCAL rm -f ${ARCHIVE} rm -f install_planet_EMC.bash fi fi echo "" echo "Use documentation file ./$FOLDER/Doc/manual.pdf if needed" exit 0