Skip to content

Commit 5eb7ae6

Browse files
committedNov 20, 2018
telem-seq.sh: Make compatible to busybox sh
busybox's sh-implementation is differnt from the normal sh: In busybox-expr an empty string does not evaluate to int(0). Calling `expr ($SEQ +1)` with `SEQ=""` fails. This patch works around this behavior by making sure the file exists. I left the pipe for stderr around the `cat` in place to make sure I do not break any other error cases. Signed-off-by: Chris Fiege <chris@tinyhost.de>
1 parent c0abb4b commit 5eb7ae6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎telemetry-toolkit/telem-seq.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Generate sequence number as described here:
33
# https://github.com/wb2osz/direwolf/issues/9
44
#
5+
if [ ! -f /tmp/seq ]; then
6+
echo 0 > /tmp/seq
7+
fi
8+
59
SEQ=`cat /tmp/seq 2>/dev/null`
610
SEQ=$(expr \( $SEQ + 1 \) % 1000)
7-
echo $SEQ | tee /tmp/seq
11+
echo $SEQ | tee /tmp/seq

0 commit comments

Comments
 (0)