mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 15:10:38 +02:00
dsv (setup): make sure file ends with a newline, so that we can "read" it
This commit is contained in:
parent
be269982f3
commit
f207be6671
34
dsv/dsv
34
dsv/dsv
@ -102,20 +102,26 @@ setup()
|
||||
echo "$n: not found" 2>&1
|
||||
continue
|
||||
fi
|
||||
while read line; do
|
||||
[ "$line" = "${line###}" ] || continue
|
||||
tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'`
|
||||
tail=`echo "$line" | sed 's/^[^\t ]*[\t ]*//'`
|
||||
if [ -z "$tmp" ]; then
|
||||
[ -z "$tail" ] || value="$value $tail"
|
||||
else
|
||||
set_value
|
||||
tag=$tmp
|
||||
value=$tail
|
||||
fi
|
||||
done <"$n"
|
||||
set_value
|
||||
eof
|
||||
#
|
||||
# "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
|
||||
[ "$line" = "${line###}" ] || continue
|
||||
tmp=`echo "$line" | awk '/^[^\t ]/ { print $1 }'`
|
||||
tail=`echo "$line" | sed 's/^[^\t ]*[\t ]*//'`
|
||||
if [ -z "$tmp" ]; then
|
||||
[ -z "$tail" ] || value="$value $tail"
|
||||
else
|
||||
set_value
|
||||
tag=$tmp
|
||||
value=$tail
|
||||
fi
|
||||
done
|
||||
set_value
|
||||
eof
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user