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