read () { TEMP="$(./temp | cut -d ' ' -f10)"
the script ./temp queries the thermometer and returns a string full of garbage aside from the temp. Failures show up as "firmware", "", or "v3.3:"
Ah, I see the issue. Let's break this apart.
A metapoint: the shell has a builtin command called `read` to read a
Ok so we rename read to something else... so far so good...
check () { if [ "$TEMP" == "v3.3:" ] || [ "$TEMP" == "" ]; then TEMP="firmware"
Note here that you _assign_ $TEMP to the string "firmware" if your conditions match. So if `$TEMP` was "v3.3:" it becomes "firmware".
Whats happening here is... firmware, v3.3: and "" are all failures, but I'm looping on firmware, so if it equals one of the other two, I change it "firmware" A successful result looks like 21.5c. This logic mostly works, at least it does for "" and firmware, I don't comprende why v3.3: is an exception.
TEMP="firmware" until [ $TEMP != "firmware" ]; do
This loop will not terminate while "$TEMP" == "firmware".
As noted above, its only checking one status on the loop, so other failures need to be made into a logical failure. It does terminate quite nicely in normal use. To be honest, when I started this, firmware was the only issue
I was looking for, then I discovered the possible results.
Metanote: You're running an `until` loop on a negative equality
while [ $TEMP == "firmware" ]; do
Again when I started what I had made sense, to me, and I was having trouble wrapping my head around the while possibility.. however it really amounts to the same thing... at least logically.. and yes yours makes more sense :)
check
...But here, you reassign $TEMP to "firmware", overwriting
whatever $TEMP had been.
So when you go around the loop again, $TEMP is "firmware"
and the loop never terminates.
Thats partially right, there are 3 failures, but success is something that doesn't match any known failure, so while it can look endless, it does exit on anything other than those values.
echo "Frankston $TEMP at $TIME" > /bbs/ansi/local.tmp
And these two lines are never executed. Note that the last
line would truncate whatever had been in local.tmp, which
may or may not be what you want.
So long as the values mentioned above aren't met this does get executed, the file local.tmp is only the current time, temperature so overwriting is a good thing. Its not a log as such. I have that being done elsewhere.
I might have to cut it out, and pore over it a bit more in a shell, but I'm not
entirely with your rewrite.. :/
Spec
--- SuperBBS v1.17-3 (Eval)
* Origin: < Scrawled in blood at The Lower Planes > (21:3/101)