Skip to content

Commit cb51bef

Browse files
kretepscottleibrand
authored andcommitted
Prevent newline (#14)
to make sure the output is strictly empty when voltage is not available.
1 parent 26c2d38 commit cb51bef

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/getvoltage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
command -v socat >/dev/null 2>&1 || { echo >&2 "I require socat but it's not installed. Aborting."; exit 1; }
44

55
RESPONSE=`echo '{"command":"read_voltage"}' | socat -,ignoreeof ~/src/openaps-menu/socket-server.sock | sed -n 's/.*"response":\([^}]*\)}/\1/p'`
6-
echo $RESPONSE
6+
[[ $RESPONSE = *[![:space:]]* ]] && echo $RESPONSE
77
#./getvoltage.sh | sed -n 's/.*"response":\([^}]*\)}/\1/p'

0 commit comments

Comments
 (0)