From d80a37461516d51b7609da8d6b21ab2bb0ce7a4f Mon Sep 17 00:00:00 2001 From: DinoMalin Date: Tue, 4 Mar 2025 17:35:46 +0100 Subject: [PATCH] feat: listen and exec ommands from the serial --- listen.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 listen.sh diff --git a/listen.sh b/listen.sh new file mode 100644 index 0000000..af05164 --- /dev/null +++ b/listen.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +while read -r line; do + line=$(echo "$line" | grep "\[CMD\]") + if [[ "$line" != "" ]]; then + cmd=$(echo $line | sed 's/\[[^]]*\]//' | sed 's/\[//' | sed 's/\]//') + bash -c "$cmd" + fi +done < /dev/ttyACM0 +