Add something like the following to the previous piece of code at the comment Other checks on the signal/annotation file:
...
if ( -z $file ) then
echo "ERROR: file $file is empty"
endif
cat $file > /dev/null
if ( $status != 0 ) then
echo "ERROR: file $file is not readable"
endif
...
Instead of emptiness you may also check for a defined
minimum length in signal or annotation files. For instance, if you know that
each signal should be at least 1 sec long, the minimum byte length of a WAV type sound file with 16kHz sampling rate, 16 bit, mono would be:
...
set length = `cat $file | wc -c`
if ( $length < 32044 ) then
echo "Warning: signal file $file is less than 1 sec long"
endif
...