1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#! /bin/bash
#.COPYRIGHT: Copyright (c) 2005-2006 European Southern Observatory,
#
#.TYPE command
#.NAME getvers.sh
#.LANGUAGE shell script
#.ENVIRONMENT Unix Systems. Executable under bash shell !
#
#
#.COMMENTS check the version of the GNU C compiler
#.AUTHOR K. Banse ESO - Garching
#
#.VERSION
# 051026 creation
# 070615 last modif
#
gcc -v > gcc.version 2>&1 # save output in file ./gcc.version
# read the file ./gcc.version line by line, process only the last one
while read line
do
begi=${line:0:12}
if [ "$begi" = "gcc version " ] ; then
longversion=${line#"gcc version "}
version=${longversion:0:1}
if [ "$version" = "4" ] ; then
echo gfortran
else
echo g77
fi
fi
done < gcc.version
rm gcc.version
exit 0
|