1 #!/bin/sh
2 for s in hallo.c gruss.c ; do
3 compile_command="gcc -c $s" # Variable mit Initialisierung
4 echo $compile_command # Wert der Variablen ausgeben
5 eval $compile_command # Wert der Variablen als Kommando ausfuehren
6 if [ $? -ne 0 ] ; then # Rueckgabewert des Kommandos pruefen
7 echo build failed
8 exit 1
9 fi
10 done
11
12 link_command="gcc -o hallo hallo.o gruss.o"
13 echo $link_command
14 eval $link_command
15 if [ $? -ne 0 ] ; then
16 echo build failed
17 exit 1
18 fi
19
20 echo build successful
21