i have an issue with my bash script
t='Hostname\cfg;'
echo "Header" > $DST
for i in *
do
t="$i;"
egrep -v "(^$|^#)" $IPLIST | while read ii
do
if grep -q "$ii" $i
then
t=$t"y;"
else
t=$t"n;"
fi
echo "$t"
done
echo "x$t"
n=$(($n + 1))
echo "$n"
#echo "$ii;$t" # >> $DST
#t=""
done
Produces the following output:
h0010001.conf;y;
h0010001.conf;y;y;
<ommited>
h0010001.conf;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;y;n;n;y;y;y;y;y;y;y;y;y;y;y;y;n;y;y;y;y;y;y;n;y;y;y;y;y;y;y;y;y;n;n;
xh0010001.conf;
So for some reason the t Variable is empty after the inner loop has completed. What I want to achieve is, to write t - after the second loop into a file.