I looked at it, but it seemed like a lot of work to create a test environment.
Maybe you could add something like the following:
Code:
$cat shrink
#/bin/bash
read in
len=`expr length "$in"`
out=""
i=1
while [ $i -le $len ]
do
letter=`echo $in|cut -c$i-$i`
if [ "a$letter" = "a " ]
then
# letter="_"
letter=""
fi
out=$out$letter
i=`expr $i + 1`
done
echo $out
and insert a line
Code:
out=`echo $filename|shrink`
to get rid of the spaces, or replace them with underscores.