1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-16 21:19:43 +02:00

dsv (setup): make sure file ends with a newline, so that we can "read" it

This commit is contained in:
Werner Almesberger 2010-11-30 19:27:59 -03:00
parent be269982f3
commit f207be6671

View File

@ -102,6 +102,11 @@ setup()
echo "$n: not found" 2>&1 echo "$n: not found" 2>&1
continue continue
fi fi
#
# "read" doesn't recognize lines that don't end with a newline.
# The cat-sed hack below works around this problems.
#
cat -E "$n" | sed 's/[^$]$/&\n/;s/$$//' | {
while read line; do while read line; do
[ "$line" = "${line###}" ] || continue [ "$line" = "${line###}" ] || continue
tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'` tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'`
@ -113,9 +118,10 @@ setup()
tag=$tmp tag=$tmp
value=$tail value=$tail
fi fi
done <"$n" done
set_value set_value
eof eof
}
done done
} }