#!/bin/bash FOLDER='satellite1.0.0' ARCHIVE='satellite1.0.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 rm -f ./tmp rm -f ./tmp2 if [ -e $FOLDER ] then echo "Directory already exists:" echo $FOLDER echo "Please erase it and try again" exit 0 else if [ ! -f $ARCHIVE ] then echo "$ARCHIVE does not exists in the current directory" echo "installation failed" exit 0 else echo "+ Uncompressing file $ARCHIVE..." tar -zxvf ${ARCHIVE} > /dev/null echo "...done" echo "The archive was extracted in: ./"$FOLDER echo "+ linking files" cd $FOLDER/data ln -s integrated_solar_TOA_fluxes_ref.txt ./integrated_solar_TOA_fluxes.txt cd $LOCAL rm -f ${ARCHIVE} rm -f install_satellite.bash fi fi exit 0