Skip to content

Commit 4563568

Browse files
author
Helio
committed
Add error handling
1 parent 917de84 commit 4563568

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

load

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ function load() {
2121
-a 0x0031 \
2222
-b "$mac_address" \
2323
--char-write-req 1>/dev/null
24+
if [[ $? != 0 ]]; then
25+
echo "Error uploading."
26+
exit 1
27+
fi
2428
((counter++))
2529
percentage="$(bc <<< "scale=2; (${counter}/${lines})*100")"
2630
progress_bar "${percentage%.*}"
@@ -34,7 +38,7 @@ elif ! [[ -r $file && -f $file ]]; then
3438
error="No such file!"
3539
else
3640
load
37-
exit
41+
exit 0
3842
fi
3943

4044
cat <<- EOH
@@ -45,3 +49,5 @@ cat <<- EOH
4549
This tool will upload the file to the BlueBasic device that has that MAC address
4650
Need gatttool installed
4751
EOH
52+
53+
exit 1

0 commit comments

Comments
 (0)