File: getvers.sh

package info (click to toggle)
eso-midas 15.09pl1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 146,960 kB
  • ctags: 55,836
  • sloc: ansic: 360,661; sh: 7,357; makefile: 6,229; pascal: 535; perl: 40; awk: 36; sed: 14
file content (39 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (14)
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