Nabend zusammen,
ich bin gerade dabei ein Shell-Script zu schreiben, dass mir eine Verzeichnisstruktur und alle Source-Files in dieser Struktur, die nicht in .nobuild stehen, in eine Datei einzutragen.
Das Script ruft sich selbst rekursiv aus.
Woran liegt es, dass es den Fehler unexpected operateor?
Gruß,
rizor
ich bin gerade dabei ein Shell-Script zu schreiben, dass mir eine Verzeichnisstruktur und alle Source-Files in dieser Struktur, die nicht in .nobuild stehen, in eine Datei einzutragen.
Das Script ruft sich selbst rekursiv aus.
Woran liegt es, dass es den Fehler unexpected operateor?
Code: [Auswählen]
# parameters:
# 1. path to this shell-script
SRC=""
OBJ=""
for file in `pwd`; do
# found the nobuild-file
if [ $file == ".nobuild" ]; then
continue
fi
# found a source-file
if [ \( -z "{$file##*.c}" -a %%file != ".c" \) -o \( -z "{$file##*.S}" -a %%file != ".S" \) ]; then
# the ".nobuild"-file exists
if [ -f ".nobuild" ]; then
# the file could not be found in the ".nobuild"-file
if [ $file != `grep "$file" .nobuild` ]; then
SRC="$SRC $file"
OBJ="$OBJ $file.o"
fi
# the ".nobuild"-file does no exist
else
SRC="$SRC $file"
OBJ="$OBJ $file.o"
fi
continue
fi
# the file is a directory
if [ -d $file ];then
# analyse the directory
cd $file
sh "$1"
cd ..
# search the "file"-file and extend our SRC and OBJ
if [ -f "$file/file" ]; then
SRC_2=`sed -ne '1p' "$file/file"`
OBJ_2=`sed -ne '2p' "$file/file"`
SRC="$SRC $SRC_2"
OBJ="$OBJ $OBJ_2"
rm -f "$file/file"
fi
fi
done
Gruß,
rizor

Übersicht
Wiki
Hilfe
Suche
Einloggen
Registrieren
Drucken

Gespeichert
