Add Color to atcmd
This commit is contained in:
@@ -7,14 +7,14 @@ BAUD=115200
|
||||
stty -F $DEVICE cs8 $BAUD ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
|
||||
|
||||
# Main loop
|
||||
echo "Type 'exit' to end the session."
|
||||
echo -e "\033[0;36mType 'exit' to end the session.\033[0m"
|
||||
while true; do
|
||||
echo -n "Enter AT Command: "
|
||||
echo -en "\033[0;36mEnter AT Command: \033[0m"
|
||||
read user_input
|
||||
|
||||
# Exit condition
|
||||
if [[ "$user_input" == "exit" ]]; then
|
||||
echo "Exiting..."
|
||||
echo -e "\033[0;32mExiting...\033[0m"
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -28,11 +28,11 @@ while true; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# Kill the background reading process
|
||||
kill $PID
|
||||
|
||||
# Print the response
|
||||
# Print the response in green
|
||||
echo -en "\033[0;32m"
|
||||
cat /tmp/response
|
||||
echo -en "\033[0m"
|
||||
|
||||
# Cleanup
|
||||
> /tmp/response
|
||||
) &
|
||||
|
||||
Reference in New Issue
Block a user