#!/bin/bash
#
#Beschreibung: Script löscht in der übergebenden Datei alle Zeilen,
#die mit einem Kommentarvermerk und dem Wort Debug beginnen, sowie
#die darauf folgende Zeile und alle Leerzeilen
#
#benötigt: 
#
#Aufruf: de_debug.sh Dateiname
#
#Hinweise und Fehler an tuxator@tuxator.de 
#
#Status: ok
###################################################################
# Kommentare in Bash #
# Kommentare in Perl #
# Kommentare in PHP //
# Kommentare in PHP /*
# Kommentare in PHP #
# Kommentare in VB Rem
# Kommentare in VB '
# Kommentare in C //
# Kommentare in C /*
if [[ ! ${1} ]]; then
	exit 1
fi
if [[ $(grep "# Debug" ${1}) ]]; then
	# Bash, Perl, PHP
	sed -i -e "/^# Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
if [[ $(grep "// Debug" ${1}) ]]; then
	# PHP, C
	sed -i -e "/^\/\/ Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
if [[ $(grep "/\* Debug" ${1}) ]]; then
	# PHP, C
	sed -i -e "/^\/\* Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
if [[ $(grep "REM Debug" ${1}) ]]; then
	# VB
	sed -i -e "/^REM Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
if [[ $(grep "Rem Debug" ${1}) ]]; then
	# VB
	sed -i -e "/^Rem Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
if [[ $(grep "' Debug" ${1}) ]]; then
	# VB
	sed -i -e "/^' Debug/,+1d; s/[ \t]*$//; /^$/d" ${1}
fi
